[FFmpeg-devel] [PATCH] avoid division by zero in libavformat/dv.c

Michael Niedermayer michaelni
Sat Apr 3 15:25:13 CEST 2010


On Sat, Apr 03, 2010 at 02:05:31PM +0200, Reinhard Tartler wrote:
> Found by report posted at:
> http://permalink.gmane.org/gmane.comp.video.ffmpeg.devel/107290
> 
> Fixes: http://tranquillity.ath.cx/clang/2010-04-02-1/report-Yx4BnH.html#EndPath
> 
> Index: libavformat/dv.c
> ===================================================================
> --- libavformat/dv.c	(revision 22580)
> +++ libavformat/dv.c	(working copy)
> @@ -122,6 +122,9 @@
>      size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */
>      half_ch = sys->difseg_size / 2;
>  
> +    if (half_ch == 0)
> +	    return -1;

this change looks wrong and i would appreciate if people would check that
clangs claims are possible before posting patches

sys should point to one of several constant structs none has a difseg_size
small enough. Clang seems just to assume that because there is some check
for half_ch in a loop and that in the first iteration checks for ==0
its possible to be 0

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100403/40cb22c7/attachment.pgp>



More information about the ffmpeg-devel mailing list