shorten: set invalid channels count to 0

Prevent the loop shorten_decode_close from writing and freeing out of
the array boundary.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
Michael Niedermayer 2013-03-05 15:13:04 +01:00 committed by Luca Barbato
parent 02055b6d40
commit c10da30d84
1 changed files with 1 additions and 0 deletions

View File

@ -341,6 +341,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 -1;
}
s->avctx->channels = s->channels;