-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8358456: ZipFile.getInputStream(ZipEntry) throws unspecified IllegalArgumentException #25606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Welcome back jpai! A progress list of the required criteria for merging this PR into |
@jaikiran This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 21 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Looks reasonable to me. I clearly did not consider invalid input for this case, assuming compressed content would at least have the two-byte deflate header. A good reminder to always consider invalid input. |
Would be interesting to know what kind of tooling produced this invalid/surprising compressed size. The JBS issues does not indicate this from what I can tell. |
Hello Eirik,
This was uncovered in tests using ZIP/JAR files created through an internal infrastructure. The tests were validating the exception type being thrown from these APIs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Jai for the changes.
They look good
Thank you Eirik and Lance for the reviews. tier1, tier2 and tier3 testing completed successfully with this change. |
/integrate |
Going to push as commit b5cfd76.
Your commit was automatically rebased without conflicts. |
Can I please get a review of this change which addresses the issue noted in https://bugs.openjdk.org/browse/JDK-8358456?
In Java 24, through https://bugs.openjdk.org/browse/JDK-8341597 we did a change which started using the "compressed size" field value for computing a input buffer size for the
InflaterInputStream
. The change was reasonable. One part of the change removed a check for<= 0
which would have taken into account invalid/unexpected "compressed size" values:From #21379
Without that check, the computed input buffer size can end up being
<= 0
which is an invalid value for a buffer size and thus results in anIllegalArgumentException
from theInflaterInputStream
constructor.My initial thought was to catch the the
IllegalArgumentException
and rethrow aZipException
, but thinking about it, this clearly is more an issue with the value that we computed as an input buffer size. So I believe the right thing here is to reintroduce the check that was previously in place and in such cases just default to reasonable sized buffer. That's what the commit in this PR does. Additionally, I renamed that variable toinputBufSize
to be clear what thissize
represents.A new jtreg test has been introduced which reproduces the issue and verifies the fix. tier testing is currently in progress.
P.S: As a separate task we might want to do a similar change as what was done in JDK-8341597, to the
ZipFileSystem
code. It currently uses the uncompressed size of the entry to decide the input buffer size.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25606/head:pull/25606
$ git checkout pull/25606
Update a local copy of the PR:
$ git checkout pull/25606
$ git pull https://git.openjdk.org/jdk.git pull/25606/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25606
View PR using the GUI difftool:
$ git pr show -t 25606
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25606.diff
Using Webrev
Link to Webrev Comment