Mercurial > libavcodec.hg
diff h264.c @ 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 | f86df3ebfef7 |
children | d07aee233d03 |
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;