[FFmpeg-cvslog] h264_sei: check SEI size

Michael Niedermayer git at videolan.org
Tue Sep 24 15:52:15 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Sep 19 16:26:25 2013 +0200| [84df6d6a85e2136be60fd34bb57dd00705a01e28] | committer: Anton Khirnov

h264_sei: check SEI size

Signed-off-by: Anton Khirnov <anton at khirnov.net>

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

 libavcodec/h264_sei.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 47f9c14..27a2c76 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -190,6 +190,12 @@ int ff_h264_decode_sei(H264Context *h)
             size += show_bits(&h->gb, 8);
         while (get_bits(&h->gb, 8) == 255);
 
+        if (size > get_bits_left(&h->gb) / 8) {
+            av_log(h->avctx, AV_LOG_ERROR, "SEI type %d truncated at %d\n",
+                   type, get_bits_left(&h->gb));
+            return AVERROR_INVALIDDATA;
+        }
+
         switch (type) {
         case SEI_TYPE_PIC_TIMING: // Picture timing SEI
             ret = decode_picture_timing(h);



More information about the ffmpeg-cvslog mailing list