diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-03-03 23:55:16 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-03 23:55:16 +0100 |
commit | cd0cfdc0a74cbf45f0d00b65faaf3cf5bd93c016 (patch) | |
tree | 8e8af8830c71a085a240e0bab554f9f3ab605a84 | |
parent | f83687bc78bea7ede4859d363c24a28f0473a5db (diff) | |
download | ffmpeg-cd0cfdc0a74cbf45f0d00b65faaf3cf5bd93c016.tar.gz |
pcm-mpeg: Check for valid bps.
The code only supports 16 and 24 bps currently, 20bps causes
out of array reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/pcm-mpeg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/pcm-mpeg.c b/libavcodec/pcm-mpeg.c index b9417733ca..934b3bde8a 100644 --- a/libavcodec/pcm-mpeg.c +++ b/libavcodec/pcm-mpeg.c @@ -69,8 +69,8 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx, /* get the sample depth and derive the sample format from it */ avctx->bits_per_coded_sample = bits_per_samples[header[3] >> 6]; - if (!avctx->bits_per_coded_sample) { - av_log(avctx, AV_LOG_ERROR, "unsupported sample depth (0)\n"); + if (avctx->bits_per_coded_sample == 16 || avctx->bits_per_coded_sample == 24) { + av_log(avctx, AV_LOG_ERROR, "unsupported sample depth (%d)\n", avctx->bits_per_coded_sample); return -1; } avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 : |