# HG changeset patch
# User lorenm
# Date 1139895653 0
# Node ID 05a10f97d510e1213347dd92c2f4e0a403845353
# Parent  16f9d33c027da6dd3adc374340fd65c9b9788b01
fix some crashes on negative nalsize.

diff -r 16f9d33c027d -r 05a10f97d510 h264.c
--- 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++){