[FFmpeg-cvslog] avcodec/pngdec: Check bits per pixel before setting monoblack pixel format
Michael Niedermayer
git at videolan.org
Sun Dec 21 04:50:28 CET 2014
ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Fri Oct 3 17:35:58 2014 +0200| [0b99a18ebc4109574ae4a619ba3716208d367e70] | committer: Michael Niedermayer
avcodec/pngdec: Check bits per pixel before setting monoblack pixel format
Fixes out of array accesses
Fixes: asan_heap-oob_14dbfcf_4_asan_heap-oob_1ce5767_179_add_method_small.png
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 3e2b745020c2dbf0201fe7df3dad9e7e0b2e1bb6)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b99a18ebc4109574ae4a619ba3716208d367e70
---
libavcodec/pngdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 4740932..2180f66 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -634,7 +634,7 @@ static int decode_frame(AVCodecContext *avctx,
} else if ((s->bits_per_pixel == 1 || s->bits_per_pixel == 2 || s->bits_per_pixel == 4 || s->bits_per_pixel == 8) &&
s->color_type == PNG_COLOR_TYPE_PALETTE) {
avctx->pix_fmt = AV_PIX_FMT_PAL8;
- } else if (s->bit_depth == 1) {
+ } else if (s->bit_depth == 1 && s->bits_per_pixel == 1) {
avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
More information about the ffmpeg-cvslog
mailing list