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

Reimar Döffinger Reimar.Doeffinger
Fri Mar 9 20:56:24 CET 2007


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
-------------- next part --------------
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);
             MPV_common_end(s);
             s->width  = s->avctx->width = new_w;



More information about the ffmpeg-devel mailing list