[FFmpeg-devel] [PATCH 2/4] huffyuvdec: avoid large stack use.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Sep 3 07:34:37 CEST 2014


On 03.09.2014, at 00:49, wm4 <nfxjfg at googlemail.com> wrote:
> On Wed,  3 Sep 2014 00:01:53 +0200
> Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:
> 
>> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
>> ---
>> libavcodec/huffyuvdec.c | 15 +++++++++------
>> 1 file changed, 9 insertions(+), 6 deletions(-)
>> 
>> diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
>> index 1df77e0..d661328 100644
>> --- a/libavcodec/huffyuvdec.c
>> +++ b/libavcodec/huffyuvdec.c
>> @@ -115,9 +115,9 @@ static int read_len_table(uint8_t *dst, GetBitContext *gb, int n)
>> 
>> static int generate_joint_tables(HYuvContext *s)
>> {
>> -    uint16_t symbols[1 << VLC_BITS];
>> -    uint16_t bits[1 << VLC_BITS];
>> -    uint8_t len[1 << VLC_BITS];
>> +    uint16_t *symbols = av_mallocz(5 << VLC_BITS);
>> +    uint16_t *bits = symbols + (1 << VLC_BITS);
> 
> Is that an unchecked malloc?

Yes, hopefully because I somehow sent an old version.
Hm no, I only fixed the other ones. Will fix.


More information about the ffmpeg-devel mailing list