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

StackOverflowError/OutOfMemoryError when dependency jar contains zip bomb inside #16893

Open
grossws opened this issue Apr 19, 2021 · 4 comments
Labels

Comments

@grossws
Copy link
Contributor

grossws commented Apr 19, 2021

Expected Behavior

Zip Bomb inside jar not to trigger any error.

Current Behavior

StackOverflowError on 7.0 and OutOfMemoryError on 6.8.3 without any context for the exception.

Context

Triggered issue after adding org.apache.tika:tika-parsers:1.22:tests.

See also: https://gradle-community.slack.com/archives/CAH4ZP3GX/p1618760838029700

Steps to Reproduce

  • Create following build.gradle.kts:
plugins { java }
dependencies { testImplementation(group = "org.apache.tika", name = "tika-parsers", version = "1.22", classifier = "tests") }
repositories { mavenCentral() }
  • Add some test class (mkdir -p src/test/java && echo 'class A {}' > src/test/java/A.java)
  • Run gradle test

Your Environment

Build scan URL: https://scans.gradle.com/s/cb5v5n5bmeyn6

@wolfs
Copy link
Member

wolfs commented May 10, 2021

This is the stacktrace:

java.lang.StackOverflowError
        at java.base/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:152)
        at java.base/java.util.zip.ZipInputStream.read(ZipInputStream.java:196)
        at java.base/java.io.FilterInputStream.read(FilterInputStream.java:132)
        at java.base/java.io.PushbackInputStream.read(PushbackInputStream.java:182)
        at java.base/java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:242)
        at java.base/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)

@lptr
Copy link
Member

lptr commented Nov 18, 2021

@ghale do you remember if this might be related to deep-zip-snapshotting you added?

@wolfs wolfs removed the to-triage label Nov 18, 2021
@ghale
Copy link
Member

ghale commented Nov 18, 2021

I think the deep-zip-snapshotting and the zip-bomb issue have been there since we first implemented the zip fingerprinting. We probably increased the number of places where this could occur when I added the functionality to hash zips found in directories, but this is not new behavior as far as I can tell.

@ghale
Copy link
Member

ghale commented Nov 18, 2021

I think the issue goes as far back as this commit: cc89468

@lptr lptr removed their assignment May 22, 2023
@ov7a ov7a added the in:dependency-resolution engine metadata label Sep 13, 2023
@lptr lptr removed the @execution label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants