[FFmpeg-cvslog] mpeg4audio: check the init_get_bits() return value

Anton Khirnov git at videolan.org
Sat Jan 17 23:06:55 CET 2015


ffmpeg | branch: release/2.4 | Anton Khirnov <anton at khirnov.net> | Thu Jan  1 17:56:56 2015 +0100| [bfe18be88a66da25b60a091de6011197dcb231fd] | committer: Luca Barbato

mpeg4audio: check the init_get_bits() return value

Fixes possible invalid reads.

CC:libav-stable at libav.org
(cherry picked from commit 7e4e010b80e76862e83afbd41c25d50e72f0b44c)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bfe18be88a66da25b60a091de6011197dcb231fd
---

 libavcodec/mpeg4audio.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index 0fb9b96..2363cb6 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -80,9 +80,11 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
                                  int bit_size, int sync_extension)
 {
     GetBitContext gb;
-    int specific_config_bitindex;
+    int specific_config_bitindex, ret;
 
-    init_get_bits(&gb, buf, bit_size);
+    ret = init_get_bits(&gb, buf, bit_size);
+    if (ret < 0)
+        return ret;
     c->object_type = get_object_type(&gb);
     c->sample_rate = get_sample_rate(&gb, &c->sampling_index);
     c->chan_config = get_bits(&gb, 4);



More information about the ffmpeg-cvslog mailing list