[FFmpeg-cvslog] libavcodec/webp: treat out-of-bound palette index as translucent black
Pascal Massimino
git at videolan.org
Fri Nov 28 20:02:23 CET 2014
ffmpeg | branch: release/2.1 | Pascal Massimino <pascal.massimino at gmail.com> | Tue Sep 16 17:01:07 2014 +0200| [5ecc4a644a1f5ee0ee677dd2db9560001d8c80c8] | committer: Michael Niedermayer
libavcodec/webp: treat out-of-bound palette index as translucent black
See https://code.google.com/p/webp/issues/detail?id=206
for a description of the problem/fix.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
This patch makes the decoder follow the recommendation of the spec.
There is some disagreement (see "[FFmpeg-devel] [PATCH]: libavcodec/webp")
about what would be best to be written in the spec, so in case the spec
is changed again, this potentially would need to be amended or reverted
(cherry picked from commit 4fd21d58a72c38ab63c3a4483b420db260fa7b8d)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ecc4a644a1f5ee0ee677dd2db9560001d8c80c8
---
libavcodec/webp.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index 213e1ce..457f1ad 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1002,7 +1002,7 @@ static int apply_color_indexing_transform(WebPContext *s)
ImageContext *img;
ImageContext *pal;
int i, x, y;
- uint8_t *p, *pi;
+ uint8_t *p;
img = &s->image[IMAGE_ROLE_ARGB];
pal = &s->image[IMAGE_ROLE_COLOR_INDEXING];
@@ -1040,11 +1040,11 @@ static int apply_color_indexing_transform(WebPContext *s)
p = GET_PIXEL(img->frame, x, y);
i = p[2];
if (i >= pal->frame->width) {
- av_log(s->avctx, AV_LOG_ERROR, "invalid palette index %d\n", i);
- return AVERROR_INVALIDDATA;
+ AV_WB32(p, 0xFF000000);
+ } else {
+ const uint8_t *pi = GET_PIXEL(pal->frame, i, 0);
+ AV_COPY32(p, pi);
}
- pi = GET_PIXEL(pal->frame, i, 0);
- AV_COPY32(p, pi);
}
}
More information about the ffmpeg-cvslog
mailing list