#354 division by zero in ControlPolygonFlatEnough()

crash or data loss

source file : bezier_2d_isect.c
function : ControlPolygonFlatEnough()
in case the first and last point of the bezier curve have the same Y:
a = V[0][Y] - V[degree][Y];
we have a division by zero:
a2 = a;
b2 = b;
c2 = c + max_distance_above;

det = a1 * b2 - a2 * b1;
dInv = 1.0/det;

being a1 always ZERO, det is != ZERO only if a2==a id different from ZERO.


  • Sean Morrison

    Sean Morrison - 2014-01-15

    Fixed in r59405. Thanks for the report!

    • huskmate13

      huskmate13 - 2015-03-31

      i just happen to have downloaded version 7.24.2 and i noticed the problem is still there. Is it right?

  • Sean Morrison

    Sean Morrison - 2014-01-15
    • status: open --> closed-fixed
    • assigned_to: Sean Morrison
    • Priority: 5 --> 7
  • Sean Morrison

    Sean Morrison - 2015-04-01

    7.24.2 is not our latest sources -- you can verify the fix by looking at sources in our subversion repository (the file is now src/librt/bezier.c and the function renamed).


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks