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

Andreas Cadhalpun git at videolan.org
Thu Nov 26 01:50:33 CET 2015


ffmpeg | branch: release/2.5 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sat Jun 27 17:50:56 2015 +0200| [85ef06c666d1b114c2a5370b21dfe43f365d57fa] | 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>
(cherry picked from commit 6b9fdf7f4f07926557048070cc2af3cfd0e3fe50)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

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

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

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index f5fd5b5..cd1da9f 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -950,6 +950,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