[OpenJDK 2D-Dev] Please review patch for 7105461
Clemens Eisserer
linuxhippy at gmail.com
Fri Sep 21 17:04:42 UTC 2012
Hi Jim,
Sorry it took so long - could you please have a look at
http://cr.openjdk.java.net/~ceisserer/7105461/webrev.02
It does now protect against integer overflow, using the Region.clipAdd.
Thanks, Clemens
2012/4/17 Jim Graham <james.graham at oracle.com>:
> 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
More information about the 2d-dev
mailing list