[Ffmpeg-devel] [PATCH] division by zero during rv20 decoding

Michael Niedermayer michaelni
Fri Mar 9 21:08:30 CET 2007


Hi

On Fri, Mar 09, 2007 at 08:56:24PM +0100, Reimar D?ffinger wrote:
> Hello,
> currently rv10.c, line 458 sets a new dimension without
> doing avcodec_check_dimensions on it first.
> This can cause a division by zero when playing in MPlayer, see
> http://bugzilla.mplayerhq.hu/show_bug.cgi?id=773
> Attached patch (to be improved by the maintainer ;-) ) fixes it, though
> none of those detected resolution should happen (and actually they only
> happen with MPlayer - couldn't test with -demuxer lavf since that
> crashes almost instantly, I might look into that if I am bored somewhen
> later).
> 
> Greetings,
> Reimar D?ffinger

> Index: libavcodec/rv10.c
> ===================================================================
> --- libavcodec/rv10.c	(revision 8306)
> +++ libavcodec/rv10.c	(working copy)
> @@ -452,7 +452,8 @@
>              new_w= s->width; //FIXME wrong we of course must save the original in the context
>              new_h= s->height;
>          }
> -        if(new_w != s->width || new_h != s->height){
> +        if((new_w != s->width || new_h != s->height) &&
> +           avcodec_check_dimensions(s->avctx, new_h, new_w) >= 0){
>              av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h);

id rather:

if(avcodec_check_dimensions(s->avctx, new_h, new_w) < 0)
    return -1;

if your code works while my suggestion doesnt, then id like to have the 
file triggering this

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

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070309/53a284e3/attachment.pgp>



More information about the ffmpeg-devel mailing list