OVERRUN_STATIC in /inkbugs/inkscape/src/dom/util/ziptool.cpp

Bug #613729 reported by Vaughn Spurlin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Unassigned
0.92.x
Fix Released
Low
Qantas94Heavy

Bug Description

OVERRUN_STATIC in /inkbugs/inkscape/src/dom/util/ziptool.cpp (lines 225-2224)

In Deflater::encodeDistStatic(...):
Out-of-bounds read from an array (CWE-125).

 1180 DistBase distBases[] =
 1181 {
 1182 { 1, 1, 0 },
...
 1211 { 24577, 8192, 13 }
 1212 };
...
 1226 for (int i=0 ; i<30 ; i++)
 1227 {
Overrunning static array "lenBases", with 29 elements, at position 29 with index variable "i".
 1228 unsigned int base = lenBases[i].base;

Tags: coverity
Revision history for this message
Vaughn Spurlin (vspurlin) wrote :

fix suggestion 2010-07-25:
 1212.1 const int distBasesLen = sizeof(distBases) / sizeof(DistBase);
...
 1226 for (int i=0 ; i<distBasesLen ; i++)

fix reason:
  Avoid hardcoded number by defining a constant that the compiler can calculate.

Revision history for this message
Jon A. Cruz (jon-joncruz) wrote :

A better fix is probably to convert lenBases to std::vector<lenBase> and distBases to std::vector<distBase>

Other static arrays in the file can similarly be converted.

Kris (kris-degussem)
Changed in inkscape:
status: New → Confirmed
Revision history for this message
Qantas94Heavy (qantas94heavy) wrote :

Fixed in master here: https://gitlab.com/inkscape/inkscape/commit/42ca25f597bc6158477002071f38f85834fa4f79

I will backport this fix to 0.92.x shortly.

Changed in inkscape:
milestone: none → 1.0
status: Confirmed → In Progress
status: In Progress → Fix Committed
Revision history for this message
Qantas94Heavy (qantas94heavy) wrote :
Max Gaukler (mgmax)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.