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

Andrew John Hughes ahughes at redhat.com
Wed Jun 16 15:18:42 UTC 2010

On 9 June 2010 23:49, Denis Lila <dlila at redhat.com> wrote:
> 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.

Webrev against 2d: http://cr.openjdk.java.net/~andrew/rh597227/

Do you have a reproducer for this?  It would help if that was included
as a JTreg test.
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8

More information about the 2d-dev mailing list