DEADCODE in /inkbugs/inkscape/src/libavoid/connector.cpp

Bug #613722 reported by Vaughn Spurlin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Triaged
Low
Michael Wybrow

Bug Description

DEADCODE in /inkbugs/inkscape/src/libavoid/connector.cpp

In Avoid…::?countRealCrossings(...):
Code can never be reached because of a logical contradiction (CWE-561).

 1282 for (size_t j = ((polyIsConn) ? 1 : 0); j < poly_size; ++j)
 1283 {
...
 1298 if ( (a1_eq_b1 && a2_eq_b2) ||
 1299 (a2_eq_b1 && a1_eq_b2) )
 1300 {
After this line (or expression), the value of "finalSegment" cannot be 0.
 1301 if (finalSegment)
 1302 {
 1303 converging = true;
 1304 }
 1305 else
// else go to bottom of for loop
 1306 {
 1307 // Route along same segment: no penalty. We detect
 1308 // crossovers when we see the segments diverge.
 1309 continue;
 1310 }
 1311 }
...
 1366 if (!p_dir_back)
 1367 {
On this path, the condition "finalSegment" cannot be false.
 1368 if (finalSegment)
 1369 {
 1370 trace_p--;
 1371 }
 1372 else
 1373 {
Execution cannot reach this statement "trace_c--;".
 1374 trace_c--;
 1375 }
 1376 }

fix suggestion 2010-07-25:
 1366 if (!p_dir_back)
 1367 {
 1368 if (finalSegment)
 1369 {
 1370 trace_p--;
 1371 }
 delete 1372- 1375
 1376 }

fix reason:
  Dead code lines not needed. Later, trace_c is assigned a value before it's used again.

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

Suggested fix included with bug report.

Changed in inkscape:
assignee: nobody → Michael Wybrow (mjwybrow)
nightrow (jb-benoit)
Changed in inkscape:
status: New → Triaged
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.