-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
ZipInputStream throws "ZipException: invalid entry CRC" on Arch Linux #4479
Comments
This makes iterating over the entries of some zip files with |
Hi, thank you for reporting this we will take a look into it and get back to you |
Hi, is it possible to have a reproducer without the docker? something I can test directly on my machine |
@oubidar-Abderrahim IIRC, if you download this JAR, and open it with a |
Hit the the same issue in Espresso, which doesn't provide intrinsics and calls the native methods directly. I substituted the native calls by a pure Java CRC32 implementation and the problem is gone. I can reproduce the issue on GraalVM (regular JVM mode) by disabling the Graal CRC32 intrinsics e.g. |
Thank you @mukel could you please share the reproducer with steps? |
Any version of OpenJDK or it's derivatives that dynamically links against (an unpatched) zlib 1.2.12 will hit this issue. A patch is already in the develop branch of zlib and Arch included the patch as well, is just a matter of time till Arch pushes a rolling update. |
Great, I'll close this issue for now. If there's anything to do on our side, please reopen it. Thank you |
Because of CRC32 miscalculation from native images there.
CRC32 calculations via
java.util.zip.CRC32
, used byZipInputStream
, are inconsistent in some cases on Arch Linux. These calculations sometimes provide different results depending on how the input file is fed toCRC32#update
.Note that this issue doesn't seem to happen on other Linux distributions (Ubuntu, Debian, Fedora), nor when running the calculations on the JVM.
Steps to reproduce the issue
See here for a detailed reproduction.
git clone https://github.com/alexarchambault/arch-linux-native-image-crc32-issue && cd arch-linux-native-image-crc32-issue
Describe GraalVM and your environment:
22.0.0.2
(also manually reproduced with the current dev release based on 8b10078)17
More details
The reproduction above computes the CRC32 of an example file in two ways:
CRC32#update
only once, with the whole content of the fileCRC32#update
multiple times, by splitting the content of the file (sizes of the chunks come fromZipInputStream
, that splits it this way while unzipping the JAR this file comes from)When run on Arch Linux (other Linux distros seem to work fine), from a native image (it runs fine on the JVM), the two calculations give different results, with the second one apparently faulty.
Output of the native image command generating the binary in the reproduction:
The text was updated successfully, but these errors were encountered: