[FFmpeg-devel] [PATCH] svq1dec: convert VLA to fixed size

Måns Rullgård mans
Thu Jun 24 02:39:45 CEST 2010


Michael Niedermayer <michaelni at gmx.at> writes:

> On Wed, Jun 23, 2010 at 11:23:51PM +0100, Mans Rullgard wrote:
>> ---
>>  libavcodec/svq1dec.c |    4 +++-
>>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> ok
>
>> 
>> diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
>> index 2aa28ab..a34b071 100644
>> --- a/libavcodec/svq1dec.c
>> +++ b/libavcodec/svq1dec.c
>> @@ -44,6 +44,8 @@
>>  #undef NDEBUG
>>  #include <assert.h>
>>  
>> +#define SVQ1_MAX_WIDTH 4095
>> +
>>  extern const uint8_t mvtab[33][2];
>>  
>>  static VLC svq1_block_type;
>> @@ -730,7 +732,7 @@ static int svq1_decode_frame(AVCodecContext *avctx,
>>          current += 16*linesize;
>>        }
>>      } else {
>> -      svq1_pmv pmv[width/8+3];
>> +      svq1_pmv pmv[SVQ1_MAX_WIDTH/8+3];
>
> if you do this please add a check that checks width being smaller
> yes i know it is currently but someone changing this could miss this

The size is read from the bitstream in 12 bits.  I cannot possibly be
larger.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list