Mercurial > libavcodec.hg
comparison h263dec.c @ 2422:18b8b2dcc037 libavcodec
various security fixes and precautionary checks
author | michael |
---|---|
date | Wed, 12 Jan 2005 00:16:25 +0000 |
parents | 0427eb3579b6 |
children | f67b63ed036d |
comparison
equal
deleted
inserted
replaced
2421:e326490f58c4 | 2422:18b8b2dcc037 |
---|---|
722 | 722 |
723 /* divx 5.01+ bistream reorder stuff */ | 723 /* divx 5.01+ bistream reorder stuff */ |
724 if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0 && s->divx_packed){ | 724 if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0 && s->divx_packed){ |
725 int current_pos= get_bits_count(&s->gb)>>3; | 725 int current_pos= get_bits_count(&s->gb)>>3; |
726 int startcode_found=0; | 726 int startcode_found=0; |
727 | 727 |
728 if( buf_size - current_pos > 5 | 728 if(buf_size - current_pos > 5){ |
729 && buf_size - current_pos < BITSTREAM_BUFFER_SIZE){ | |
730 int i; | 729 int i; |
731 for(i=current_pos; i<buf_size-3; i++){ | 730 for(i=current_pos; i<buf_size-3; i++){ |
732 if(buf[i]==0 && buf[i+1]==0 && buf[i+2]==1 && buf[i+3]==0xB6){ | 731 if(buf[i]==0 && buf[i+1]==0 && buf[i+2]==1 && buf[i+3]==0xB6){ |
733 startcode_found=1; | 732 startcode_found=1; |
734 break; | 733 break; |
739 startcode_found=1; | 738 startcode_found=1; |
740 current_pos=0; | 739 current_pos=0; |
741 } | 740 } |
742 | 741 |
743 if(startcode_found){ | 742 if(startcode_found){ |
743 s->bitstream_buffer= av_fast_realloc( | |
744 s->bitstream_buffer, | |
745 &s->allocated_bitstream_buffer_size, | |
746 buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE); | |
744 memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos); | 747 memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos); |
745 s->bitstream_buffer_size= buf_size - current_pos; | 748 s->bitstream_buffer_size= buf_size - current_pos; |
746 } | 749 } |
747 } | 750 } |
748 | 751 |