Module: libav
Branch: release/0.8
Commit: 184c79729d4011f33027bcdc61a63d521017ebc1

Author:    Michael Niedermayer <[email protected]>
Committer: Vittorio Giovara <[email protected]>
Date:      Thu Sep 19 16:26:25 2013 +0200

h264_sei: check SEI size

Signed-off-by: Anton Khirnov <[email protected]>
Signed-off-by: Vittorio Giovara <[email protected]>

---

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

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

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to