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

8321396: Retire test/jdk/java/util/zip/NoExtensionSignature.java #16975

Closed
wants to merge 3 commits into from

Conversation

eirbjo
Copy link
Contributor

@eirbjo eirbjo commented Dec 5, 2023

Please review this PR which suggests we retire the ZIP test NoExtensionSignature along with its test.jar test vector.

The concern of a missing data descriptor signature is covered by the recently updated DataDescriptorSignatureMissing test, see #12959. That test is more complete, includes more documentation and uses a programmatically generated test vector.

Careful analysis of the deleted test.jar test vector revealed that it contains a local header with non-zero compressed size and uncompressed size fields for a streaming-mode entry. APPNOTE.TXT mandates that when bit 3 of the general purpose bit flag is set, then these fields and the crc field should all be set to zero.

By injecting assertions into ZipInputStream.readLOC I was able to determine that NoExtensionSignature is the only test currently parsing a ZIP file with such non-zero fields in streaming mode.

Because of this, and out of caution, this PR introduces a new test DataDescriptorIgnoreCrcAndSizeFields which explicitly verifies that ZipInputStream does not read any non-zero crc, compressed size or uncompressed size field values from a local header when in streaming mode. ZipInputStream should ignore these values and it would be good to have a test which asserts that this invariant holds even when the fields are non-zero.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8321396: Retire test/jdk/java/util/zip/NoExtensionSignature.java (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16975/head:pull/16975
$ git checkout pull/16975

Update a local copy of the PR:
$ git checkout pull/16975
$ git pull https://git.openjdk.org/jdk.git pull/16975/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16975

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16975.diff

Webrev

Link to Webrev Comment

…ureMissing. Introduce the new test DataDescriptorIgnoreCrcAndSizeFields covering unrelated aspects implicitly tested by NoExtensionSignature.
@bridgekeeper
Copy link

bridgekeeper bot commented Dec 5, 2023

👋 Welcome back eirbjo! 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
Copy link

openjdk bot commented Dec 5, 2023

@eirbjo 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 Dec 5, 2023
@eirbjo eirbjo marked this pull request as ready for review December 7, 2023 16:57
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 7, 2023
@mlbridge
Copy link

mlbridge bot commented Dec 7, 2023

Webrevs

@eirbjo
Copy link
Contributor Author

eirbjo commented Dec 7, 2023

For completeness, here is a trace of the deleted test.zip:

------  Local File Header  ------
000000  signature          0x04034b50     
000004  version            20             
000006  flags              0x0008         
000008  method             8              Deflated
000010  time               0x9a45         19:18:10
000012  date               0x2c47         2002-02-07
000014  crc                0x00000000     
000018  csize              2              
000022  size               2              
000026  nlen               8              
000028  elen               0              
000030  name               8 bytes        'test.txt'

------  File Data  ------
000038  data               4 bytes        

------  Data Descriptor  ------
000042  crc                0xd8932aac     
000046  csize              4              
000050  size               2              

------  Central Directory File Header  ------
000054  signature          0x02014b50     
000058  made by version    788            
000060  extract version    20             
000062  flags              0x0008         
000064  method             8              Deflated
000066  time               0x9a45         19:18:10
000068  date               0x2c47         2002-02-07
000070  crc                0xd8932aac     
000074  csize              4              
000078  size               2              
000082  diskstart          0              
000084  nlen               8              
000086  elen               0              
000088  clen               0              
000090  iattr              0x00           
000092  eattr              0x81b60000     
000096  loc offset         0              
000100  name               8 bytes        'test.txt'

------  End of Central Directory  ------
000108  signature          0x06054b50     
000112  this disk          0              
000114  cen disk           0              
000116  entries disk       1              
000118  entries total      1              
000120  cen size           54             
000124  cen offset         54             
000128  clen               0  

@LanceAndersen
Copy link
Contributor

Please review this PR which suggests we retire the ZIP test NoExtensionSignature along with its test.jar test vector.

The concern of a missing data descriptor signature is covered by the recently updated DataDescriptorSignatureMissing test. That test is more complete, includes more documentation and uses a programmatically generated test vector.

Eirik, Could you add a reference to PR 12959 or to JDK-8303920 in the above

@eirbjo
Copy link
Contributor Author

eirbjo commented Dec 7, 2023

Eirik, Could you add a reference to PR 12959 or to JDK-8303920 in the above

Thanks, that makes sense!

@eirbjo
Copy link
Contributor Author

eirbjo commented Dec 8, 2023

Here's the relevant section from APPNOTE.TXT:

4.4.4 general purpose bit flag: (2 bytes)
[..]
Bit 3: If this bit is set, the fields crc-32, compressed 
       size and uncompressed size are set to zero in the 
       local header. The correct values are put in the 
       data descriptor immediately following the compressed
       data.

One could argue we should validate and throw a ZipException for such entries, but that is perhaps a question for another PR.

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 5, 2024

@eirbjo This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@openjdk
Copy link

openjdk bot commented Feb 2, 2024

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

8321396: Retire test/jdk/java/util/zip/NoExtensionSignature.java

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

  • adc3604: 8325148: Enable restricted javac warning in java.base
  • 1ae8513: 8324858: [vectorapi] Bounds checking issues when accessing memory segments
  • 38c0197: 8318105: [jmh] the test java.security.HSS failed with 2 active threads
  • 6787c4c: 8325055: Rename Injector.h
  • 91d8dac: 8325137: com/sun/management/ThreadMXBean/ThreadCpuTimeArray.java can fail in Xcomp with out of expected range
  • 783ae56: 8311893: Interactive component with ARIA role 'tabpanel' does not have a programmatically associated name
  • d3c3194: 6285888: ChoiceFormat can support unescaped relational symbols in the Format segment
  • 144a08e: 8325078: Better escaping of single and double quotes in javac annotation toString() results
  • b3ecd55: 8324679: Replace NULL with nullptr in HotSpot .ad files
  • 192349e: 8324066: "clhsdb jstack" should not by default scan for j.u.c locks because it can be very slow
  • ... and 259 more: https://git.openjdk.org/jdk/compare/e10d14004fa25998231ab1d2611b75aea9b5c67d...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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 2, 2024
@eirbjo
Copy link
Contributor Author

eirbjo commented Feb 2, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Feb 2, 2024

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

  • f613e13: 8313739: ZipOutputStream.close() should always close the wrapped stream
  • adc3604: 8325148: Enable restricted javac warning in java.base
  • 1ae8513: 8324858: [vectorapi] Bounds checking issues when accessing memory segments
  • 38c0197: 8318105: [jmh] the test java.security.HSS failed with 2 active threads
  • 6787c4c: 8325055: Rename Injector.h
  • 91d8dac: 8325137: com/sun/management/ThreadMXBean/ThreadCpuTimeArray.java can fail in Xcomp with out of expected range
  • 783ae56: 8311893: Interactive component with ARIA role 'tabpanel' does not have a programmatically associated name
  • d3c3194: 6285888: ChoiceFormat can support unescaped relational symbols in the Format segment
  • 144a08e: 8325078: Better escaping of single and double quotes in javac annotation toString() results
  • b3ecd55: 8324679: Replace NULL with nullptr in HotSpot .ad files
  • ... and 260 more: https://git.openjdk.org/jdk/compare/e10d14004fa25998231ab1d2611b75aea9b5c67d...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Feb 2, 2024
@openjdk openjdk bot closed this Feb 2, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Feb 2, 2024
@openjdk
Copy link

openjdk bot commented Feb 2, 2024

@eirbjo Pushed as commit 63cb1f8.

💡 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
2 participants