Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@funky-eyes
Copy link
Contributor

@funky-eyes funky-eyes commented Aug 8, 2025

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@funky-eyes funky-eyes added this to the 2.6.0 milestone Aug 8, 2025
@funky-eyes funky-eyes changed the title optimize: zstd decompression method has been changed from JNI to ZstdInputStream optimize: zstd decompression is changed from jni to ZstdInputStream Aug 8, 2025
@codecov
Copy link

codecov bot commented Aug 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.78%. Comparing base (26d7c15) to head (5a8b73e).
⚠️ Report is 1 commits behind head on 2.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7578      +/-   ##
============================================
- Coverage     60.83%   60.78%   -0.06%     
+ Complexity      658      656       -2     
============================================
  Files          1308     1308              
  Lines         49432    49437       +5     
  Branches       5810     5811       +1     
============================================
- Hits          30072    30049      -23     
- Misses        16697    16724      +27     
- Partials       2663     2664       +1     
Files with missing lines Coverage Δ
...ava/org/apache/seata/compressor/zstd/ZstdUtil.java 93.33% <100.00%> (+3.33%) ⬆️

... and 7 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@funky-eyes funky-eyes requested review from Copilot and slievrly August 8, 2025 06:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes zstd decompression by switching from JNI-based approach to using ZstdInputStream for safer memory handling. The change prevents potential OOM attacks when decompressing maliciously crafted zstd data with fake frame content sizes.

  • Replaced direct JNI decompression with streaming-based ZstdInputStream approach
  • Updated exception handling to throw IllegalArgumentException instead of ZstdException
  • Added comprehensive test coverage for OOM attack scenarios with fake frame content sizes

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
ZstdUtil.java Refactored decompress method to use ZstdInputStream instead of direct JNI calls
ZstdUtilTest.java Updated exception expectations and added new test for OOM attack prevention
changes/zh-cn/2.x.md Added Chinese changelog entry for the optimization
changes/en-us/2.x.md Added English changelog entry for the optimization
Comments suppressed due to low confidence (1)

…a/compressor/zstd/ZstdUtilTest.java

Co-authored-by: Copilot <[email protected]>
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

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

LGTM

@slievrly slievrly merged commit c83ab1f into apache:2.x Aug 9, 2025
10 checks passed
YvCeung pushed a commit to YvCeung/incubator-seata that referenced this pull request Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants