[FFmpeg-cvslog] r23111 - trunk/libavcodec/iff.c

rbultje subversion
Thu May 13 17:33:37 CEST 2010


Author: rbultje
Date: Thu May 13 17:33:36 2010
New Revision: 23111

Log:
Handle palette underflows, fill remaining space with black (zero) data.

Patch by Sebastian Vater <cdgs basty googlemail com>.

Modified:
   trunk/libavcodec/iff.c

Modified: trunk/libavcodec/iff.c
==============================================================================
--- trunk/libavcodec/iff.c	Thu May 13 15:18:25 2010	(r23110)
+++ trunk/libavcodec/iff.c	Thu May 13 17:33:36 2010	(r23111)
@@ -123,10 +123,8 @@ int ff_cmap_read_palette(AVCodecContext 
     }
 
     count = 1 << avctx->bits_per_coded_sample;
-    if (avctx->extradata_size < count * 3) {
-        av_log(avctx, AV_LOG_ERROR, "palette data underflow\n");
-        return AVERROR_INVALIDDATA;
-    }
+    // If extradata is smaller than actually needed, fill the remaining with black.
+    count = FFMIN(avctx->extradata_size / 3, count);
     for (i=0; i < count; i++) {
         pal[i] = 0xFF000000 | AV_RB24( avctx->extradata + i*3 );
     }



More information about the ffmpeg-cvslog mailing list