Repository navigation
fix match length overflow in blosclz_decompress - #411
Open
suraiya-ctrl wants to merge 1 commit into
Open
suraiya-ctrl wants to merge 1 commit into
suraiya-ctrl wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
blosclz_decompressgrows the length of a long match (ctrl >> 5 == 7) by adding each following0xffbyte to anint32_t len, with no upper bound:0xffbytes pusheslenpastINT32_MAX; the wrapped negative value passesop + len > op_limitand becomes the copy size forcopy_match()/memset()/wild_copy()blosc_decompress,blosc_decompress_ctxandblosc_getitemon an untrusted buffer, and the header still passesblosc_cbuffer_validatelen > maxout - codebefore each additionRepro (ASan + UBSan), one 4096-byte blosclz block whose split is an 8-byte literal followed by such a match:
Valid streams are unaffected: any match whose length passes
maxoutis already rejected by the laterop + len > op_limitcheck.tests/test_blosclz_match_len.ccrashes on the current tree and passes with the fix; the full ctest suite passes on arm64 macOS (1647/1647, and 1636/1636 under ASan/UBSan).