RFR 8231451: ZipFileInputStream::skip handling of negative values with STORED entries
Lance Andersen
lance.andersen at oracle.com
Fri Oct 18 11:38:11 UTC 2019
Thank you for the feedback Alan.
> On Oct 18, 2019, at 7:18 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
> On 16/10/2019 18:06, Lance Andersen wrote:
>> Hi all,
>>
>> Please review this fix to ZipFileInputStream::skip when specifying a negative value to the skip method when accessing a STORED entry, https://bugs.openjdk.java.net/browse/JDK-8231451 <https://bugs.openjdk.java.net/browse/JDK-8231451>. Prior to this fix, you could move past the beginning of the STORED entry.
>>
>> I also added a release note, https://bugs.openjdk.java.net/browse/JDK-8232384 <https://bugs.openjdk.java.net/browse/JDK-8232384>, to help clarify the behavior of these methods when a negative value is specified.
>>
>> The webrev can be found at: http://cr.openjdk.java.net/~lancea/8231451/webrev.00/index.html <http://cr.openjdk.java.net/~lancea/8231451/webrev.00/index.html>
>>
> This seems to introduce inconsistency in that an attempt to seek beyond EOF will return the number of bytes skipped or 0 where as attempting to seek to before the start will throw IOException.
Yes I noticed this also but thought (at the time) throwing the exception made sense in the case moving past BOF…
> It might be a corner case but a better alternative might be to seek to position 0, returning the number of bytes that were (negatively) skipped to get to 0.
I can make the change you propose and update the release note and send a revised patch.
Thank you.
Best
Lance
>
> -Alan.
<http://oracle.com/us/design/oracle-email-sig-198324.gif>
<http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
<http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>
More information about the core-libs-dev
mailing list