[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    [OpenJDK 2D-Dev] Please review patch for 7105461
From:       james.graham () oracle ! com (Jim Graham)
Date:       2012-04-17 21:02:42
Message-ID: 4F8DDA72.4070907 () oracle ! com
[Download RAW message or body]

This code doesn't protect against integer overflow.  We don't protect 
against it in many places, but it couldn't hurt to get in the habit.  I 
think the Region code has some methods that do safe addition of integers 
with simple limit clipping that would work fine for rectangle dimensions.

(JDK8 will be introducing new methods in Math for unsigned results and 
exact non-overflowing integer results as well, but that would complicate 
any backports to JDK7...)

			...jim

On 4/13/12 9:46 AM, Clemens Eisserer wrote:
> Hi,
>
> Please take a look at the patch for bug 7105461, located at
> http://cr.openjdk.java.net/~ceisserer/7105461/webrev.00/
>
> The problem was caused by Swing calling drawLine/fillRect with
> coordinates outside the valid X11 coordinate space.
> I took the same approach of the original X11 pipeline to simply clamp
> the corrdinates to the min/max allowed value although its not enterly
> correct - as it doesn't adjust width/height in case it clamps x/y -
> triggered for exmaple by the following call:
> 	g.fillRect(-32868, 0, 32968, 10);
>
> Should I take care of this special case, or is it ok to handle it the
> same way the X11 pipeline does?
>
> Thanks, Clemens

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic