RFR: JDK-8294702 - BufferedInputStream uses undefined value range for markpos [v2]

Brian Burkhalter bpb at openjdk.org
Mon Oct 10 20:51:48 UTC 2022


On Sun, 9 Oct 2022 14:04:45 GMT, Markus KARG <duke at openjdk.org> wrote:

>>> This is true, but if a broken subclass sets markpos to less than -1 then lots of code lines will work incorrectly -- including `transferTo` which was the starting point of your change proposal. So do you really only want undo the change _here_, or is it better drop this PR and even use `< 0` in `transferTo`, as I originally proposed?
>> 
>> This looks to be the only that would corrupt the current position (pos). 
>> 
>> @bplb plans to look at this too, another set of eyes would be good on this point.
>
> @AlanBateman Checking `< 0` just here, as per your proposal. 👍 
> 
> @bplb Kindly requesting `/sponsor`. 😃

I don't see any problems here, but I question to a degree the value of the change which is not really fixing any observed broken behavior but cosmetically restricting `markpos` to the specified range `[-1, pos]` instead of `[Integer.MIN_VALUE, pos]`.

-------------

PR: https://git.openjdk.org/jdk/pull/10528


More information about the core-libs-dev mailing list