Skip to content

Commit e9d53f6

Browse files
michielp1807folkertdev
authored andcommitted
Fix handling of ZSTD_CONTENTSIZE_ERROR
1 parent 054f99b commit e9d53f6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/decompress/zstd_decompress.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,12 @@ fn get_frame_header_advanced(
11441144
_ => ZSTD_CONTENTSIZE_UNKNOWN,
11451145
};
11461146

1147+
// We check for content size error here because the original C code would also interpret this
1148+
// content size as an error
1149+
if frameContentSize == ZSTD_CONTENTSIZE_ERROR {
1150+
return Err(Error::corruption_detected);
1151+
}
1152+
11471153
if singleSegment {
11481154
windowSize = frameContentSize;
11491155
}

0 commit comments

Comments
 (0)