| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…ful failure handling Handle oversized ZSTD frames gracefully by logging an error and failing the connection instead of crashing.
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
sequenceDiagram
participant Peer as Remote Peer (compressed data)
participant Decomp as stream_decompress_zstd()
participant Buffer as Output Buffer (COMPRESSION_MAX_CHUNK)
participant Logger as netdata_log_error
participant Conn as Stream Connection Manager
participant Test as unittest_stream_decompress_bomb_zstd()
participant ZSTD_Comp as ZSTD_compress()
Note over Peer,Conn: Production Flow — ZSTD Frame Handling
Peer->>Decomp: compressed data (may be bomb)
Decomp->>Buffer: decompress into fixed-size buffer
alt InBuffer still has leftover bytes after buffer full
Decomp->>Decomp: detect oversized frame
Note over Decomp,Logger: NEW: graceful handling instead of fatal()
Decomp->>Logger: netdata_log_error("…failing the connection")
Decomp-->>Conn: return 0 (error)
Conn->>Conn: tear down connection / fail stream
else No leftover (normal frame)
Decomp-->>Conn: decompressed_size
Conn->>Conn: continue streaming
end
Note over Test,Conn: Regression Test (unittest_stream_decompress_bomb_zstd())
Test->>ZSTD_Comp: compress 2MB zeros -> bomb frame
ZSTD_Comp-->>Test: compressed bomb (small)
Test->>Decomp: stream_decompress(bomb)
Decomp->>Buffer: decompress, buffer fills, data left
Decomp->>Logger: netdata_log_error (graceful)
Decomp-->>Test: return 0
Test->>Test: assert return == 0 (no crash)
Test->>ZSTD_Comp: compress "the quick brown fox..." -> normal frame
ZSTD_Comp-->>Test: compressed normal
Test->>Decomp: stream_decompress(normal)
Decomp->>Buffer: decompress, fully consumed
Decomp-->>Test: return original length
Test->>Test: assert data matches original
Sorry, something went wrong.
There was a problem hiding this comment.
Replication and streaming are working as expected. LGTM!
Sorry, something went wrong.
|
Sorry, something went wrong.
…ata#22830) * Add regression test for ZSTD decompression-bomb guard to verify graceful failure handling Handle oversized ZSTD frames gracefully by logging an error and failing the connection instead of crashing. * Fix comment to use correct constant name (COMPRESSION_MAX_MSG_SIZE) in ZSTD stream handling * Handle ZSTD compression errors by logging and returning failure gracefully
* Add regression test for ZSTD decompression-bomb guard to verify graceful failure handling Handle oversized ZSTD frames gracefully by logging an error and failing the connection instead of crashing. * Fix comment to use correct constant name (COMPRESSION_MAX_MSG_SIZE) in ZSTD stream handling * Handle ZSTD compression errors by logging and returning failure gracefully
| Back | FazBrowse Home | New Git URL |
Summary
Summary by cubic
Reject oversized ZSTD frames by logging and cleanly failing the stream instead of fatal()-ing the agent. Adds a regression test and improves ZSTD error handling.
Written for commit 25154f8. Summary will update on new commits.