changeset 11718:f2beca0bbf98 libavcodec

Handle palette underflows, fill remaining space with black (zero) data. Patch by Sebastian Vater <cdgs basty googlemail com>.
author rbultje
date Thu, 13 May 2010 15:33:36 +0000
parents 269ce565c70b
children 30356abc8604
files iff.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/iff.c	Thu May 13 13:18:25 2010 +0000
+++ b/iff.c	Thu May 13 15:33:36 2010 +0000
@@ -123,10 +123,8 @@
     }
 
     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 );
     }