[MPlayer-dev-eng] [PATCH] vd_ffmpeg auto-insert crop filter for H.263 movies

Jindrich Makovicka makovick at kmlinux.fjfi.cvut.cz
Mon May 23 12:01:09 CEST 2005


Gianluigi Tiesi wrote:
> On Mon, May 23, 2005 at 05:25:51PM +0800, Timothy Lee wrote:
> 
>>This patch fixes the H.263 display problem mentioned in 
>>http://mplayerhq.hu/pipermail/mplayer-dev-eng/2004-July/027777.html
>>
>>
>>Regards,
>>Timothy Lee
>>
> 
> 
> char w_str[30];
> char h_str[30];
> 
> are a bit arbitrary even if it's enough,
> it should be
> char *w_str = (char *) malloc ( ((int) log10(sh->bih->biWidth) + 2) );
> char *h_str = (char *) malloc ( ((int) log10(sh->bih->biHeight)) + 2) );
> 
> ...
> ...
> free(w_str);
> free(h_str);
> 
> but this will involve including math.h
> This is just a suggestion :)
> Bye

biWidth & biHeight are 64-bit, so 30 characters are certainly enough.
snprintf should be used to be 100% sure about buffer overflow prevention
though.

-- 
Jindrich Makovicka




More information about the MPlayer-dev-eng mailing list