You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Location: shenyu-web/src/main/java/org/apache/shenyu/web/filter/FileSizeFilter.java:76-84 (rejection path, no release) vs :98 (.doFinally release only on success path)
Description:
When the size check at line 78 rejects the upload (dataBuffer.capacity() > Constants.BYTES_PER_MB * fileMaxSize), the lambda returns WebFluxResultUtils.result(exchange, error) at line 84 without releasing dataBuffer. The doFinally(signalType -> DataBufferUtils.release(dataBuffer)) is only on the success-path bodyInsert.insert(...).then(...).doFinally(...) chain (line 98), not the rejection branch.
Impact:
Every rejected oversized multipart upload leaks one pooled DataBuffer (up to fileMaxSize MB of Netty direct memory). An attacker sending oversized multipart bodies can exhaust the pooled direct-memory arena, causing OutOfDirectMemoryError with no GC recovery.
Suggested fix:
Add .doFinally(signalType -> DataBufferUtils.release(dataBuffer)) to the rejection-path Mono, or restructure so both paths share a single outer doFinally.
Confidence: High
Related existing: [BUG] FileSizeFilter make memory leak #4505 (CLOSED, the original leak fix) — that fix only patched the success path and left the rejection path leaking. This is an incomplete-fix regression, not a dup.
shenyu-web/src/main/java/org/apache/shenyu/web/filter/FileSizeFilter.java:76-84(rejection path, no release) vs:98(.doFinallyrelease only on success path)Description:
When the size check at line 78 rejects the upload (
dataBuffer.capacity() > Constants.BYTES_PER_MB * fileMaxSize), the lambda returnsWebFluxResultUtils.result(exchange, error)at line 84 without releasingdataBuffer. ThedoFinally(signalType -> DataBufferUtils.release(dataBuffer))is only on the success-pathbodyInsert.insert(...).then(...).doFinally(...)chain (line 98), not the rejection branch.Impact:
Every rejected oversized multipart upload leaks one pooled
DataBuffer(up tofileMaxSizeMB of Netty direct memory). An attacker sending oversized multipart bodies can exhaust the pooled direct-memory arena, causingOutOfDirectMemoryErrorwith no GC recovery.Suggested fix:
Add
.doFinally(signalType -> DataBufferUtils.release(dataBuffer))to the rejection-path Mono, or restructure so both paths share a single outerdoFinally.Confidence: High
Identified during the 2026-08-02 deep re-scan; full list in
docs/scan2-2026-08-02/00-consolidated-critical-high.md.