Re: [PATCH] 6788196: Array bounds checks in io_util.c rely on undefined behaviour

2009-01-06 Thread Martin Buchholz
Hi Gary, I will be your submitter for this fix. I don't think it's worth adding checks for array length being non-negative. We can add tests to the existing test case jdk/test/java/io/readBytes/ReadBytesBounds.java I am providing a patch which has a revised patch and test. Please forgive me fo

Re: [PATCH] 6788196: Array bounds checks in io_util.c rely on undefined behaviour

2009-01-06 Thread Andrew Haley
Gary Benson wrote: > Andrew Haley wrote: >> There are some indentation SNAFUs here. Maybe due to tab width set >> to 4? > > That's Martin's patch, which got inlined in the reply. My patch is > the attachment. Ahh, the evils of top-posting. Just Say No... :-) Andrew.

Re: [PATCH] 6788196: Array bounds checks in io_util.c rely on undefined behaviour

2009-01-06 Thread Gary Benson
Andrew Haley wrote: > There are some indentation SNAFUs here. Maybe due to tab width set > to 4? That's Martin's patch, which got inlined in the reply. My patch is the attachment. Cheers, Gary -- http://gbenson.net/

Re: [PATCH] 6788196: Array bounds checks in io_util.c rely on undefined behaviour

2009-01-06 Thread Gary Benson
Alan Bateman wrote: > I checked the pre-OpenJDK history and this bounds check has been so > since 1.2 (10+ years old). It's kinda surprising this hasn't been > noticed with other ports. Did you run into this with an existing > test (JCK or regression/unit)? Ideally we should have more tests to > ca

Re: [PATCH] 6788196: Array bounds checks in io_util.c rely on undefined behaviour

2009-01-06 Thread Alan Bateman
Gary Benson wrote: Hi Martin, I like your method of avoiding the overflow, it's a nice idea. I agree, and also better matches the method specification. I've attached an updated version of my original patch, with that, and with an expanded comment too, to make sure the fix doesn't get rever

Re: [PATCH] 6788196: Array bounds checks in io_util.c rely on undefined behaviour

2009-01-06 Thread Andrew Haley
Gary Benson wrote: > Hi Martin, > > I like your method of avoiding the overflow, it's a nice idea. > I've attached an updated version of my original patch, with that, > and with an expanded comment too, to make sure the fix doesn't > get reverted later on in the interests of readability or whateve

Re: [PATCH] 6788196: Array bounds checks in io_util.c rely on undefined behaviour

2009-01-06 Thread Gary Benson
Hi Martin, I like your method of avoiding the overflow, it's a nice idea. I've attached an updated version of my original patch, with that, and with an expanded comment too, to make sure the fix doesn't get reverted later on in the interests of readability or whatever. Can I ask that you file a s