RFR: JDK-8294702 - BufferedInputStream uses undefined value range for markpos [v2]
Brian Burkhalter
bpb at openjdk.org
Tue Oct 11 15:43:52 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.
I am aware of the context and agree that `-1 <= markpos <= pos` should be `true`, but am simply pointing out that it does not really fix an observable problem and no change is without risk.
-------------
PR: https://git.openjdk.org/jdk/pull/10528
More information about the core-libs-dev
mailing list