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

Andrey Utkin andrey.krieger.utkin at gmail.com
Sun Feb 2 13:30:58 CET 2014


2014-02-02 anshul <anshul.ffmpeg at gmail.com>:
> 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.

(Just being lazy to analyze)
Did you happen to have valgrind report about reading uninitialized
memory there? It would be very good proof.

-- 
Andrey Utkin


More information about the ffmpeg-devel mailing list