[FFmpeg-devel] Stack usage in FFmpeg

Michael Niedermayer michaelni
Mon Nov 2 13:09:32 CET 2009


On Sun, Nov 01, 2009 at 10:21:06PM +0000, matthieu castet wrote:
> M?ns Rullg?rd <mans <at> mansr.com> writes:
> 
> > 
> > Back in January, I posted a list of functions using 4k stack space or
> > more [1], and one truly terrible and a few lesser cases were promptly
> > fixed.
> > 
> > Here's a list of worst stack users today:
> >  262144 ljpeg_decode_rgb_scan          mjpegdec.c:617
> 
> The code does
> 
> 
> uint16_t buffer[32768][4];
> set buffer[0]
> for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
>   use buffer[0]
>   for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
>     use buffer[mb_x] /* uninitialized access for mb_x != 0 ??? */
>     set buffer[mb_x];
>   }
>   if(s->rct)
>     for(mb_x = 0; mb_x < s->mb_width; mb_x++)
>        use buffer[mb_x]
>   else if(s->pegasus_rct)
>     for(mb_x = 0; mb_x < s->mb_width; mb_x++)
>        use buffer[mb_x]
>   else
>     for(mb_x = 0; mb_x < s->mb_width; mb_x++)
>        use buffer[mb_x]
> }
> 
> It seems there is a uninitialized access.
> Or may be I misunderstood something.

the uninitialized value is read but not used

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091102/c32b9208/attachment.pgp>



More information about the ffmpeg-devel mailing list