UNINIT in /inkbugs/inkscape/src/libvpsc/csolve_vpsc.cpp
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Fix Released
|
Medium
|
Kris |
Bug Description
UNINIT in /inkbugs/
In genYConstraints():
Reads an uninitialized pointer or its target (CWE-457).
45int genYConstraints(int n, boxf* bb, Variable** vs, Constraint*** cs) {
Declaring variable "rs" without initializer.
46 Rectangle* rs[n];
At conditional (1): "i < n" taking the false branch.
47 for(int i=0;i<n;i++) {
48 rs[i]=new Rectangle(
49 }
Using uninitialized element of array "rs" when calling "vpsc::
50 int m = generateYConstr
Changed in inkscape: | |
status: | Fix Committed → Fix Released |
fix suggestion 2010-07-25:
45.1 assert(n > 0);
fix reason:
insert a line to ensure that rs[n] is created with at least 1 element.
looked for origin of n's value to ensure that it was >= 1.
found a chain of assumptions that the value is good, without verification.
current code is brittle, so add assert() for protection.