RFR 8231451: ZipFileInputStream::skip handling of negative values with STORED entries
Lance Andersen
lance.andersen at oracle.com
Tue Oct 22 17:00:41 UTC 2019
> 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. 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.
>
Per your suggestion, I tweaked the patch to move to BOF when the negative skip value goes beyond BOF. I updated the release note as well.
webrev can be found at: http://cr.openjdk.java.net/~lancea/8231451/webrev.01/index.html <http://cr.openjdk.java.net/~lancea/8231451/webrev.01/index.html>
mach 5 jdk1 - jdk3 tiers continue to pass.
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