Blame SOURCES/wavpack-0011-issue-110-sanitize-DSD-file-types.patch

3968e2
commit 3915cf88c0cf2cf9806d7323071c9b856b6dc52b
3968e2
Author: Tomas Korbar <tkorbar@redhat.com>
3968e2
Date:   Tue May 17 18:11:33 2022 +0200
3968e2
3968e2
    Fix CVE-2021-44269
3968e2
3968e2
diff --git a/cli/dsdiff.c b/cli/dsdiff.c
3968e2
index 62d8a0c..fa69e32 100644
3968e2
--- a/cli/dsdiff.c
3968e2
+++ b/cli/dsdiff.c
3968e2
@@ -284,6 +284,12 @@ int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
3968e2
                 return WAVPACK_SOFT_ERROR;
3968e2
             }
3968e2
             total_samples = dff_chunk_header.ckDataSize / config->num_channels;
3968e2
+            
3968e2
+            if (total_samples <= 0 || total_samples > MAX_WAVPACK_SAMPLES) {
3968e2
+                error_line ("%s is not a valid .DFF file!", infilename);
3968e2
+                return WAVPACK_SOFT_ERROR;
3968e2
+            }
3968e2
+
3968e2
             break;
3968e2
         }
3968e2
         else {          // just copy unknown chunks to output file
3968e2
diff --git a/cli/dsf.c b/cli/dsf.c
3968e2
index cd82ae9..fd6b2a5 100644
3968e2
--- a/cli/dsf.c
3968e2
+++ b/cli/dsf.c
3968e2
@@ -121,6 +121,7 @@ int ParseDsfHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackC
3968e2
 
3968e2
     if (format_chunk.ckSize != sizeof (DSFFormatChunk) || format_chunk.formatVersion != 1 ||
3968e2
         format_chunk.formatID != 0 || format_chunk.blockSize != DSF_BLOCKSIZE || format_chunk.reserved ||
3968e2
+        format_chunk.sampleCount <= 0 || format_chunk.sampleCount > MAX_WAVPACK_SAMPLES * 8 ||
3968e2
         (format_chunk.bitsPerSample != 1 && format_chunk.bitsPerSample != 8) ||
3968e2
         format_chunk.chanType < 1 || format_chunk.chanType > NUM_CHAN_TYPES) {
3968e2
             error_line ("%s is not a valid .DSF file!", infilename);