Blame SOURCES/wavpack-0009-issue-66-make-sure-CAF-files-have-a-desc-chunk.patch

6c343d
diff --git a/cli/caff.c b/cli/caff.c
6c343d
index 2a5e2d9..a35da74 100644
6c343d
--- a/cli/caff.c
6c343d
+++ b/cli/caff.c
6c343d
@@ -152,7 +152,7 @@ static struct {
6c343d
 
6c343d
 int ParseCaffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config)
6c343d
 {
6c343d
-    uint32_t chan_chunk = 0, channel_layout = 0, bcount;
6c343d
+    uint32_t chan_chunk = 0, desc_chunk = 0, channel_layout = 0, bcount;
6c343d
     unsigned char *channel_identities = NULL;
6c343d
     unsigned char *channel_reorder = NULL;
6c343d
     int64_t total_samples = 0, infilesize;
6c343d
@@ -218,6 +218,7 @@ int ParseCaffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpack
6c343d
             }
6c343d
 
6c343d
             WavpackBigEndianToNative (&caf_audio_format, CAFAudioFormatFormat);
6c343d
+            desc_chunk = 1;
6c343d
 
6c343d
             if (debug_logging_mode) {
6c343d
                 char formatstr [5];
6c343d
@@ -458,7 +459,7 @@ int ParseCaffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpack
6c343d
         else if (!strncmp (caf_chunk_header.mChunkType, "data", 4)) {     // on the data chunk, get size and exit loop
6c343d
             uint32_t mEditCount;
6c343d
 
6c343d
-            if (!DoReadFile (infile, &mEditCount, sizeof (mEditCount), &bcount) ||
6c343d
+            if (!desc_chunk || !DoReadFile (infile, &mEditCount, sizeof (mEditCount), &bcount) ||
6c343d
                 bcount != sizeof (mEditCount)) {
6c343d
                     error_line ("%s is not a valid .CAF file!", infilename);
6c343d
                     return WAVPACK_SOFT_ERROR;