changeset 3126:05a10f97d510 libavcodec

fix some crashes on negative nalsize.
author lorenm
date Tue, 14 Feb 2006 05:40:53 +0000
parents 16f9d33c027d
children 6bae70889b35
files h264.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Mon Feb 13 18:13:13 2006 +0000
+++ b/h264.c	Tue Feb 14 05:40:53 2006 +0000
@@ -7507,6 +7507,15 @@
         nalsize = 0;
         for(i = 0; i < h->nal_length_size; i++)
             nalsize = (nalsize << 8) | buf[buf_index++];
+        if(nalsize <= 1){
+            if(nalsize == 1){
+                buf_index++;
+                continue;
+            }else{
+                av_log(h->s.avctx, AV_LOG_ERROR, "AVC: nal size %d\n", nalsize);
+                break;
+            }
+        }
       } else {
         // start code prefix search
         for(; buf_index + 3 < buf_size; buf_index++){