RFR 8231451: ZipFileInputStream::skip handling of negative values with STORED entries

Alan Bateman Alan.Bateman at oracle.com
Fri Oct 18 11:18:13 UTC 2019


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.

-Alan.


More information about the core-libs-dev mailing list