From 811a504c6bc2586a8ea5d52fbcfee94277123eb5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 13 Feb 2013 01:03:30 +0100 Subject: [PATCH] shorten: dont leave invalid channel counts in the context. Fixes freeing invalid addresses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 4f1279154ee9baf2078241bf5619774970d18b25) Signed-off-by: Michael Niedermayer --- libavcodec/shorten.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 8e66928db5..1d1f7eca07 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -343,6 +343,7 @@ static int read_header(ShortenContext *s) s->channels = get_uint(s, CHANSIZE); if (s->channels <= 0 || s->channels > MAX_CHANNELS) { av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels); + s->channels = 0; return AVERROR_INVALIDDATA; } s->avctx->channels = s->channels;