]> git.ipfire.org Git - thirdparty/zstd.git/commit
Streaming decompression can detect incorrect header ID sooner 3175/head
authorYann Collet <cyan@fb.com>
Wed, 22 Jun 2022 01:14:11 +0000 (18:14 -0700)
committerYann Collet <cyan@fb.com>
Wed, 22 Jun 2022 06:09:03 +0000 (23:09 -0700)
commit91aeade7352a31b96944ee68112e748d0c42635c
treedd1b56c338010bb0df808f16eb0e95f8272ebc3d
parentf6ef14329f396eb8b2c1290790e7547d070d9511
Streaming decompression can detect incorrect header ID sooner

Streaming decompression used to wait for a minimum of 5 bytes before attempting decoding.
This meant that, in the case that only a few bytes (<5) were provided,
and assuming these bytes are incorrect,
there would be no error reported.
The streaming API would simply request more data, waiting for at least 5 bytes.

This PR makes it possible to detect incorrect Frame IDs as soon as the first byte is provided.

Fix #3169
lib/decompress/zstd_decompress.c
tests/zstreamtest.c