Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion programs/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -3515,7 +3515,7 @@ FIO_analyzeFrames(fileInfo_t* info, FILE* const srcFile)
/* Skippable frame */
else if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
U32 const frameSize = MEM_readLE32(headerBuffer + 4);
long const seek = (long)(8 + frameSize - numBytesRead);
S64 const seek = (S64)ZSTD_SKIPPABLEHEADERSIZE + frameSize - (S64)numBytesRead;
ERROR_IF(LONG_SEEK(srcFile, seek, SEEK_CUR) != 0,
info_frame_error, "Error: could not find end of skippable frame");
info->numSkippableFrames++;
Expand Down
5 changes: 5 additions & 0 deletions tests/playTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,11 @@ rm -f $TEST_DATA_FILE
rm -f $FULL_COMPRESSED_FILE
rm -f $TRUNCATED_COMPRESSED_FILE

println "test : detect skippable frame larger than file "
printf '\120\052\115\030\370\377\377\377payload' > tmp_skippable.zst # skippable magic, Frame_Size 0xFFFFFFF8
zstd --list tmp_skippable.zst && die "-l must fail on truncated skippable frame"
rm -f tmp_skippable.zst

println "\n===> zstd --list/-l errors when presented with stdin / no files"
zstd -l && die "-l must fail on empty list of files"
zstd -l - && die "-l does not work on stdin"
Expand Down