[Ffmpeg-devel] Fix for overflow issue in mpegvideo.c

Loren Merritt lorenm
Tue Jul 26 17:55:32 CEST 2005


On Tue, 26 Jul 2005, Martin Boehme wrote:

> Michael Niedermayer wrote:
>> On Monday 25 July 2005 17:23, Martin Boehme wrote:
>>> the attached patch fixes an overflow issue I was getting for
>>> (overconservatively) large buffer sizes and large picture heights, i.e.
>>> buf_size=2.5 MB and end_y=1024. I'm aware this buf_size is _much_ too
>>> large (being lazy, I allocate enough buffer for a complete uncompressed
>>> image so I _know_ it will be enough)... OTOH, ffmpeg's (static) buffer
>>> size (256 KB) is already within an order of magnitude of the "critical"
>>> size.
>> 
>> applied
>> btw i dont think buf_size=width*height*1.5 is enough, try random 255/0 
>> sample values at qp=1, btw2 if you actually try this i would be interrested 
>> in the results
>
> Tried it, with MPEG-4 I get about width*height*3.63 bytes per frame... ouch. 
> So I now use width*height*4... ;-) under the assumption that the above is 
> just about the worst case... (BTW, is that true?)

I can get width*height*5.292 using
-lavcopts keyint=1:vqscale=1:intra_matrix=1,1,1,...
(which spews "warning, clipping 1 dct coefficients to -2048..2047")

Or width*height*5.657 by modifying the code to force all dct coefficients 
to +/- 2047 and force all blocks to be inter4v.

--Loren Merritt





More information about the ffmpeg-devel mailing list