@@ -152,7 +152,7 @@ static struct {
152152
153153int ParseCaffHeaderConfig (FILE * infile , char * infilename , char * fourcc , WavpackContext * wpc , WavpackConfig * config )
154154{
155- uint32_t chan_chunk = 0 , channel_layout = 0 , bcount ;
155+ uint32_t chan_chunk = 0 , desc_chunk = 0 , channel_layout = 0 , bcount ;
156156 unsigned char * channel_identities = NULL ;
157157 unsigned char * channel_reorder = NULL ;
158158 int64_t total_samples = 0 , infilesize ;
@@ -218,6 +218,7 @@ int ParseCaffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpack
218218 }
219219
220220 WavpackBigEndianToNative (& caf_audio_format , CAFAudioFormatFormat );
221+ desc_chunk = 1 ;
221222
222223 if (debug_logging_mode ) {
223224 char formatstr [5 ];
@@ -458,7 +459,7 @@ int ParseCaffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpack
458459 else if (!strncmp (caf_chunk_header .mChunkType , "data" , 4 )) { // on the data chunk, get size and exit loop
459460 uint32_t mEditCount ;
460461
461- if (!DoReadFile (infile , & mEditCount , sizeof (mEditCount ), & bcount ) ||
462+ if (!desc_chunk || ! DoReadFile (infile , & mEditCount , sizeof (mEditCount ), & bcount ) ||
462463 bcount != sizeof (mEditCount )) {
463464 error_line ("%s is not a valid .CAF file!" , infilename );
464465 return WAVPACK_SOFT_ERROR ;
0 commit comments