[Ffmpeg-devel] [PATCH] two little wmadec improvements

Reimar Döffinger Reimar.Doeffinger
Mon Jun 26 23:57:43 CEST 2006


Hello,
the attached patch features two improvements:
the first make RLE decode overrun non-fatal, which seems to fix 
http://www.missouri.edu/~bah347/gprime/nintendothemesacappellax.wmv
though I didn't compare directly to the binary decoder, so I guess it
only hides the real bug. Still an improvement though.
The second one is just a guess, since current code does not make sense
IMHO, doesn't make a difference for any of my samples.

Greetings,
Reimar D?ffinger
-------------- next part --------------
Index: libavcodec/wmadec.c
===================================================================
--- libavcodec/wmadec.c	(revision 5528)
+++ libavcodec/wmadec.c	(working copy)
@@ -908,7 +908,10 @@
                     level = -level;
                 ptr += run;
                 if (ptr >= eptr)
-                    return -1;
+                {
+                    av_log(NULL, AV_LOG_ERROR, "overflow in spectral RLE, ignoring\n");
+                    break;
+                }
                 *ptr++ = level;
                 /* NOTE: EOB can be omitted */
                 if (ptr >= eptr)
@@ -1236,7 +1239,7 @@
                 goto fail;
             q = s->last_superframe + s->last_superframe_len;
             len = bit_offset;
-            while (len > 0) {
+            while (len > 7) {
                 *q++ = (get_bits)(&s->gb, 8);
                 len -= 8;
             }



More information about the ffmpeg-devel mailing list