[FFmpeg-devel] initializing re allocated memory in drawtext filter

anshul anshul.ffmpeg at gmail.com
Sun Feb 2 13:22:37 CET 2014


On 02/02/2014 03:33 PM, Andrey Utkin wrote:
> Could you please explain why do you think this addition is needed?
>
> --
> Andrey Utkin
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
If we don't memset the memory then there is a list of functions that do 
use uninitialized memory.


take the case of clip_interval(int wmax, int *x, int *w, int *dx)
if memset is not done then x contain undefined value, if that undefined 
value is 0 or make greater the
whole comparison greater then wmax

here is code for quick reference
289     if (dx)
290         *dx = 0;
291     if (*x < 0) {
292         if (dx)
293             *dx = -*x;
294         *w += *x;
295         *x = 0;
296     }
297     if (*x + *w > wmax)
298         *w = wmax - *x;
over here x is used uninitialized

while the issue occurring due this not initialization are not very deep 
means we will never get an system crash, or no output but the quality of 
draw text would not be good and worse it would not
be of good quality some time.

Thanks
Anshul


More information about the ffmpeg-devel mailing list