Menu

#199 Signed integer overflow in function `compute_ellarc`

fig2dev
pending
nobody
None
2025-12-14
2025-12-08
No

When running the tests with enabled sanitizers (address, undefined), I encountered a signed integer overflow on bound.c, line 1306:

    radius = round(sqrt(rx * rx + ry * ry));

My suggested fix is to use the function hypot from the standard library or to convert to double, similar to how it's done on line 989:

l = sqrt((double)dx * dx + (double)dy * dy);

Discussion

  • tkl

    tkl - 2025-12-10

    Good point, also, hypot() is not used anywhere in the code. I changed the sqrt(..) in a number of places to hypot, but need to check a bit before committing.

     
  • tkl

    tkl - 2025-12-14
    • status: open --> pending
    • xfig / fig2dev: xfig --> fig2dev
     
  • tkl

    tkl - 2025-12-14

    Fixed with commit [6919a3].

     

    Related

    Commit: [6919a3]


Log in to post a comment.