From a8789714ba858a663d30f4676016d5bc7368c823 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sun, 15 Oct 2006 04:50:19 +0000 Subject: [PATCH] Ignore blocks with no samples and flags (but usually with MD5 sum) Originally committed as revision 6694 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/wavpack.c | 1 + libavformat/wv.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 53ba34b69..5a54f7d0e 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -388,6 +388,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); s->samples = LE_32(buf); buf += 4; + if(!s->samples) return buf_size; /* should not happen but who knows */ if(s->samples * 2 * avctx->channels > AVCODEC_MAX_AUDIO_FRAME_SIZE){ av_log(avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n"); diff --git a/libavformat/wv.c b/libavformat/wv.c index e601c05fc..86b7a7bd9 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -118,15 +118,15 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb) if(!wc->chan) wc->chan = chan; if(!wc->rate) wc->rate = rate; - if(bpp != wc->bpp){ + if(wc->flags && bpp != wc->bpp){ av_log(ctx, AV_LOG_ERROR, "Bits per sample differ, this block: %i, header block: %i\n", bpp, wc->bpp); return -1; } - if(chan != wc->chan){ + if(wc->flags && chan != wc->chan){ av_log(ctx, AV_LOG_ERROR, "Channels differ, this block: %i, header block: %i\n", chan, wc->chan); return -1; } - if(rate != wc->rate){ + if(wc->flags && rate != wc->rate){ av_log(ctx, AV_LOG_ERROR, "Sampling rate differ, this block: %i, header block: %i\n", rate, wc->rate); return -1; } -- 2.11.0