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

Andreas Cadhalpun git at videolan.org
Thu Jul 23 02:17:05 CEST 2015


ffmpeg | branch: release/2.6 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sat Jun 27 17:50:56 2015 +0200| [a3d3e0a6bc392025538276614d55a4be2d897d7e] | committer: Michael Niedermayer

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>
(cherry picked from commit eddf146ada12b394a7796af12bff2121505dc4a1)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 056d6fb..056f1f2 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