]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Detect multiple dictIDs in one file 3184/head
authorhtnhan <htn@fb.com>
Fri, 8 Jul 2022 17:20:50 +0000 (12:20 -0500)
committerhtnhan <htn@fb.com>
Fri, 8 Jul 2022 17:20:50 +0000 (12:20 -0500)
programs/fileio.c

index 86906bed3a34daf62f733fc2ed50b03b9b54a1fa..b8b2818bcd83e08839235084b7c1e8dc6a3959d8 100644 (file)
@@ -2776,7 +2776,12 @@ FIO_analyzeFrames(fileInfo_t* info, FILE* const srcFile)
                 }
                 ERROR_IF(ZSTD_getFrameHeader(&header, headerBuffer, numBytesRead) != 0,
                         info_frame_error, "Error: could not decode frame header");
-                info->dictID = header.dictID;
+                if (info->dictID != 0 && info->dictID != header.dictID) {
+                    DISPLAY("WARNING: File contains multiple frames with different dictionary IDs. Showing dictID 0 instead");
+                    info->dictID = 0;
+                } else {
+                    info->dictID = header.dictID;
+                }
                 info->windowSize = header.windowSize;
                 /* move to the end of the frame header */
                 {   size_t const headerSize = ZSTD_frameHeaderSize(headerBuffer, numBytesRead);