[FFmpeg-devel] Stack usage in FFmpeg

matthieu castet castet.matthieu
Sun Nov 1 23:21:06 CET 2009


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.


Matthieu




More information about the ffmpeg-devel mailing list