Module: libav
Branch: release/0.8
Commit: 95a9d44dc3121a93c68087dddd7b9b49d34bf930

Author:    Ronald S. Bultje <[email protected]>
Committer: Reinhard Tartler <[email protected]>
Date:      Fri Feb 17 15:20:27 2012 -0800

mp3on4: require a minimum framesize.

If bufsize < headersize, init_get_bits() will be called with a negative
number, causing it to fail and any subsequent call to get_bits() will
crash because it reads from a NULL pointer.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: [email protected]
(cherry picked from commit 3e13005cac6e076053276b515f5fcf59a3f4b65d)

Signed-off-by: Anton Khirnov <[email protected]>

---

 libavcodec/mpegaudiodec.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index a83b162..860c0c3 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1921,6 +1921,10 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, 
void *data,
         m     = s->mp3decctx[fr];
         assert(m != NULL);
 
+        if (fsize < HEADER_SIZE) {
+            av_log(avctx, AV_LOG_ERROR, "Frame size smaller than header 
size\n");
+            return AVERROR_INVALIDDATA;
+        }
         header = (AV_RB32(buf) & 0x000fffff) | s->syncword; // patch header
 
         if (ff_mpa_check_header(header) < 0) // Bad header, discard block

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to