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

Markus KARG duke at openjdk.org
Tue Oct 11 13:12:05 UTC 2022


On Tue, 4 Oct 2022 15:53:04 GMT, Alan Bateman <alanb 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 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.

This PR originates from @AlanBateman who asked me to change my use of `== 1` to `< 0`. Per his opinion, using `< 0` is allegedly wrong, as it violates the spec of `markpos`. As it either it is wrong *everywhere* or *nowhere*, he agreed that this should be fixed. So guys, please discuss with each other what way you finally want it to be like. Thanks.

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

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


More information about the core-libs-dev mailing list