From 028458b9f642e168d2977a2534b9896018246c67 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Thu, 12 Apr 2012 19:42:02 +1000 Subject: [PATCH] src/ : Exit parser loop when marker == 0. --- ChangeLog | 3 +++ src/aiff.c | 4 ++++ src/wav.c | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9b9f3164..8c392d26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ Fix regression in handling of odd length SSND chunks. Thanks Olivier Tristan for the example file. + * src/aiff.c src/wav.c + Exit parser loop when marker == 0. + 2012-04-04 Erik de Castro Lopo * doc/FAQ.html diff --git a/src/aiff.c b/src/aiff.c index a09232e7..1171c91e 100644 --- a/src/aiff.c +++ b/src/aiff.c @@ -416,6 +416,10 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt) marker = chunk_size = 0 ; psf_binheader_readf (psf, "Ejm4", jump, &marker, &chunk_size) ; + if (marker == 0) + { psf_log_printf (psf, "Have 0 marker.\n") ; + break ; + } ; if (psf->file.mode == SFM_RDWR && (found_chunk & HAVE_SSND)) return SFE_AIFF_RW_SSND_NOT_LAST ; diff --git a/src/wav.c b/src/wav.c index 82dfb2c6..d845ef7c 100644 --- a/src/wav.c +++ b/src/wav.c @@ -349,6 +349,10 @@ wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock) marker = chunk_size = 0 ; psf_binheader_readf (psf, "jm4", jump, &marker, &chunk_size) ; + if (marker == 0) + { psf_log_printf (psf, "Have 0 marker.\n") ; + break ; + } ; psf_store_read_chunk_u32 (&psf->rchunks, marker, psf_ftell (psf), chunk_size) ;