ffmpeg | branch: release/6.1 | Leo Izen <leo.i...@gmail.com> | Fri Jul 12 15:03:16 2024 -0400| [09c1c0b12653c34137e5075889fe91a69447845f] | committer: Leo Izen
avcodec/pngdec: avoid erroring with sBIT on indexed-color images Indexed color images use three colors for sBIT, but the function ff_png_get_nb_channels returns 1 in this case. We should avoid erroring out on valid files in this scenario. Regression since 84b454935fae2633a8a5dd075e22393f3e8f932f. Signed-off-by: Leo Izen <leo.i...@gmail.com> Reported-by: Ramiro Polla <ramiro.po...@gmail.com> Reviewed-by: Marton Balint <c...@passwd.hu> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09c1c0b12653c34137e5075889fe91a69447845f --- libavcodec/pngdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 657d0a9f4e..3318309009 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -1023,7 +1023,7 @@ static int decode_sbit_chunk(AVCodecContext *avctx, PNGDecContext *s, return AVERROR_INVALIDDATA; } - channels = ff_png_get_nb_channels(s->color_type); + channels = s->color_type & PNG_COLOR_MASK_PALETTE ? 3 : ff_png_get_nb_channels(s->color_type); if (bytestream2_get_bytes_left(gb) != channels) return AVERROR_INVALIDDATA; _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".