zlib: reject truncated zstd input · nodejs/node@0ee91ea · GitHub
Skip to content

Commit 0ee91ea

Browse files
Archkonaduh95
authored andcommitted
zlib: reject truncated zstd input
Treat an unfinished Zstd frame as an unexpected end of file when the stream is finalized with ZSTD_e_end. Avoid reporting an error while the output buffer still needs to be drained or when an empty final write follows a completed frame. Preserve partial decompression when ZSTD_e_flush is used. Signed-off-by: Archkon <180910180+Archkon@users.noreply.github.com> PR-URL: #64593 Fixes: #64592 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ryuhei Shima <shimaryuhei@gmail.com>
1 parent 1e034e6 commit 0ee91ea

2 files changed

Lines changed: 83 additions & 5 deletions

File tree

src/node_zlib.cc

Lines changed: 29 additions & 0 deletions

test/parallel/test-zlib-truncated.js

Lines changed: 54 additions & 5 deletions

0 commit comments

Comments
 (0)