[FFmpeg-cvslog] smacker: check frame size validity

Kostya Shishkov git at videolan.org
Tue Aug 27 15:59:06 CEST 2013


ffmpeg | branch: release/1.1 | Kostya Shishkov <kostya.shishkov at gmail.com> | Wed Jun 12 14:30:51 2013 +0200| [7e326d52a783fd2f1a93e07bdb2ce74176d4c4a6] | committer: Luca Barbato

smacker: check frame size validity

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
(cherry picked from commit 07423ad7836325e03894f2f87ba46a531a1cc0b3)

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

 libavformat/smacker.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index df074a4..4a3a2b3 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -304,10 +304,14 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
         /* if audio chunks are present, put them to stack and retrieve later */
         for(i = 0; i < 7; i++) {
             if(flags & 1) {
-                int size;
+                uint32_t size;
                 uint8_t *tmpbuf;
 
                 size = avio_rl32(s->pb) - 4;
+                if (!size || size > frame_size) {
+                    av_log(s, AV_LOG_ERROR, "Invalid audio part size\n");
+                    return AVERROR_INVALIDDATA;
+                }
                 frame_size -= size;
                 frame_size -= 4;
                 smk->curstream++;



More information about the ffmpeg-cvslog mailing list