changeset 9898:003d7f830e2a libavcodec

Fix nalsize check to avoid an integer overflow that made the check incorrect for nalsize > INT_MAX - buf_index
author reimar
date Tue, 30 Jun 2009 12:11:29 +0000
parents d69eaf40d1b8
children 06ab8ac1a593
files h264.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Tue Jun 30 06:44:32 2009 +0000
+++ b/h264.c	Tue Jun 30 12:11:29 2009 +0000
@@ -7505,7 +7505,7 @@
             nalsize = 0;
             for(i = 0; i < h->nal_length_size; i++)
                 nalsize = (nalsize << 8) | buf[buf_index++];
-            if(nalsize <= 1 || (nalsize+buf_index > buf_size)){
+            if(nalsize <= 1 || nalsize > buf_size - buf_index){
                 if(nalsize == 1){
                     buf_index++;
                     continue;