aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2006-02-14 05:40:53 +0000
committerLoren Merritt <lorenm@u.washington.edu>2006-02-14 05:40:53 +0000
commit8b031359589dbe4ad207f014325c3341b795b625 (patch)
tree9cf8cba038824c0bf81321181f4bc63f3ee6df49 /libavcodec
parent214c5f26c9acd231056753dc2d336d73040bff34 (diff)
downloadffmpeg-8b031359589dbe4ad207f014325c3341b795b625.tar.gz
fix some crashes on negative nalsize.
Originally committed as revision 5022 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 4c2f0cb7ec..a90f9facd5 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -7507,6 +7507,15 @@ static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
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++){