Skip to content

check snappy block length before crc trailer in decode_snappy#3807

Open
dxbjavid wants to merge 1 commit into
apache:mainfrom
dxbjavid:snappy-block-len-check
Open

check snappy block length before crc trailer in decode_snappy#3807
dxbjavid wants to merge 1 commit into
apache:mainfrom
dxbjavid:snappy-block-len-check

Conversation

@dxbjavid
Copy link
Copy Markdown

@dxbjavid dxbjavid commented Jun 5, 2026

decode_snappy in lang/c/src/codec.c takes the block length straight from the container file, where file_read_block_count only rejects negative values, so a snappy block of 1 to 3 bytes reaches it and the len-4 used for snappy_uncompressed_length, snappy_uncompress and the trailing CRC memcmp underflows to a huge size_t and reads out of bounds. The C++ reader in DataFile.cc already refuses len < 4 before the same subtraction, so add the matching check here.

@github-actions github-actions Bot added the C label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant