Browse Source

prevent going out of the buffer if the nal size does not fit in the buffer.

Patch by Mean % fixounet A free P fr %
Original thread:
Date: Apr 29, 2007 2:00 PM
Subject: Re: [Ffmpeg-devel] [patch] h264.c, dont go beyond buffer in h264_decode_nal_unit

Originally committed as revision 8858 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Mean Guillaume Poirier 18 years ago
parent
commit
dcc3a30b58
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavcodec/h264.c

+ 1
- 1
libavcodec/h264.c View File

@@ -8122,7 +8122,7 @@ 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 || nalsize > buf_size){
if(nalsize <= 1 || (nalsize+buf_index > buf_size)){
if(nalsize == 1){
buf_index++;
continue;


Loading…
Cancel
Save