[OpenJDK 2D-Dev] Fix for bug where long dashed lines can make graphics go black.

Denis Lila dlila at redhat.com
Wed Jun 9 22:49:35 UTC 2010


Hello.

I think I have a fix for this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=597227

The bug was caused by a few integer overflows in sun/java2d/pisces/Dasher.java 
and sun/java2d/pisces/Stroker.java which would cause the whole container to
fill up with whatever colour the line had. Dasher.java was prone to 2 overflows:
one when computing the x and y coordinate lengths of the line at hand, and
another which actually happened in PiscesMath.hypot(int,int). I fixed these
two by turning the variables into longs and using PiscesMath.hypot(long,long).

Stroker.java was only prone to overflows when drawing end caps or when adding
offsets to points. I fixed these by making sure lineTo and moveTo never moved
too close to the boundaries set by Integer.MAX_VALUE and Integer.MIN_VALUE.

I welcome any feedback.

Thank you,
Denis Lila.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dashedLinesBlackWindowBugFix.patch
Type: text/x-patch
Size: 7068 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20100609/45fa7955/dashedLinesBlackWindowBugFix.patch>


More information about the 2d-dev mailing list