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

Michael Niedermayer michaelni
Sat Apr 3 19:05:51 CEST 2010


On Sat, Apr 03, 2010 at 04:55:49PM +0200, Reinhard Tartler wrote:
> On Sat, Apr 03, 2010 at 15:25:13 (CEST), Michael Niedermayer wrote:
> 
> > 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
> 
> 
> 
> would it be acceptable to add an assert(half_ch != 0) with that comment here?

iam not really maintainer of dv, just reviewng dv patches as the maintainer
isnt around. And this is probably more a question for him

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- 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/9ae2215c/attachment.pgp>



More information about the ffmpeg-devel mailing list