Navigation Menu

Skip to content
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

8278794: Infinite loop in DeflaterOutputStream.finish() #7804

Closed
wants to merge 3 commits into from

Conversation

raviniitw2012
Copy link

@raviniitw2012 raviniitw2012 commented Mar 13, 2022

Hi All,

This review request contains fix for infinite loop issue in DeflaterOutputStream.finish() in an exception scenario.

  1. The issue is with 'finished' flag not getting set to correct value when there is an IOException in
    DeflaterOutputStream.finish() which will result in Infinite loops for next write operations on the same deflater.
  2. Tighten the condition(to close deflater) in ZipOutputStream using an already existing 'finish' flag in Deflater class.
  3. Added Inflater exception scenarios also to the test case, renaming test case to CloseInflaterDeflaterTest.java from CloseDeflaterTest.java

Thanks,
Ravi


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8278794: Infinite loop in DeflaterOutputStream.finish()

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7804/head:pull/7804
$ git checkout pull/7804

Update a local copy of the PR:
$ git checkout pull/7804
$ git pull https://git.openjdk.java.net/jdk pull/7804/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 7804

View PR using the GUI difftool:
$ git pr show -t 7804

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7804.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 13, 2022

👋 Welcome back rreddy! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 13, 2022
@openjdk
Copy link

openjdk bot commented Mar 13, 2022

@raviniitw2012 The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Mar 13, 2022
@mlbridge
Copy link

mlbridge bot commented Mar 13, 2022

Webrevs

Copy link
Contributor

@coffeys coffeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good approach to solve reported issue.

throw new IOException();
}
@Override
public void write(byte b[]) throws IOException {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be consistant with style and use "byte[] b"

Same with line 70

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks , I am now using "byte[] b" in both write() and read() methods.

@openjdk
Copy link

openjdk bot commented Mar 16, 2022

@raviniitw2012 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:

8278794: Infinite loop in DeflaterOutputStream.finish()

Reviewed-by: coffeys, lancea

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 87 new commits pushed to the master branch:

  • b96cb04: 8283353: compiler/c2/cr6865031/Test.java and compiler/runtime/Test6826736.java fails on x86_32
  • cab4ff6: 8283225: ClassLoader.c produces incorrect OutOfMemory Exception when length is 0 (aix)
  • d83cee9: 8282407: Missing ')' in MacResources.properties
  • 002e366: 8283325: US_ASCII decoder relies on String.decodeASCII being exhaustive
  • b004fb0: 8282773: Refactor parsing of integer VM options
  • 5ef1990: 8283274: Improve @JVMS usage in java.base
  • 31df6a6: 8283188: Build time regression caused by JDK-8278917
  • 0f1766d: 8283320: Error message for Windows libraries always points to --with-msvcr-dll no matter the actual file name
  • 69e4e33: 8283056: show abstract machine code in hs-err for all VM crashes
  • bad658e: 8282727: Parallel: Remove PSPromotionManager::_totally_drain
  • ... and 77 more: https://git.openjdk.java.net/jdk/compare/3fc009be8a49f9edb8059d8612ef6ed7f048f242...master

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@coffeys, @LanceAndersen) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 16, 2022
Copy link
Contributor

@LanceAndersen LanceAndersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Ravi,

Thank you for the additional work on this issue.

Overall this looks good. If possible, could you please follow the format for comments as in open/test/jdk/java/util/zip/ZipFile/GetInputStreamNPETest.java for tests and DataProviders as it would be great to try and be consistent as we update and add new tests.

…ean up of test case by using less data providers
@raviniitw2012
Copy link
Author

Thanks Lance for the review , In the latest commit , I have formatted the comments in the test case.

Copy link
Contributor

@LanceAndersen LanceAndersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Ravi,

Thank you for cleaning up the comments. Much appreciated!

@raviniitw2012
Copy link
Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Mar 18, 2022
@openjdk
Copy link

openjdk bot commented Mar 18, 2022

@raviniitw2012
Your change (at version ac86708) is now ready to be sponsored by a Committer.

@LanceAndersen
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Mar 18, 2022

Going to push as commit ff0b092.
Since your change was applied there have been 91 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 18, 2022
@openjdk openjdk bot closed this Mar 18, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Mar 18, 2022
@openjdk
Copy link

openjdk bot commented Mar 18, 2022

@LanceAndersen @raviniitw2012 Pushed as commit ff0b092.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
3 participants