[FFmpeg-cvslog] nutdec: check maxpos in read_sm_data before returning success

Andreas Cadhalpun git at videolan.org
Sat Jun 27 19:23:21 CEST 2015


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sat Jun 27 17:50:56 2015 +0200| [6b9fdf7f4f07926557048070cc2af3cfd0e3fe50] | committer: Andreas Cadhalpun

nutdec: check maxpos in read_sm_data before returning success

Otherwise sm_size can be larger than size, which results in a negative
packet size.

Reviewed-by: Michael Niedermayer <michaelni at gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

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

 libavformat/nutdec.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 13fb399..606deaa 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -1005,6 +1005,9 @@ static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int
         AV_WL32(dst+4, skip_end);
     }
 
+    if (avio_tell(bc) >= maxpos)
+        return AVERROR_INVALIDDATA;
+
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list