aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Izen <leo.izen@gmail.com>2024-07-12 15:03:17 -0400
committerLeo Izen <leo.izen@gmail.com>2024-07-18 21:20:38 -0400
commit90e28331c7887b83d7c508bea71735ae12dad177 (patch)
treec0e754f7435bea7dbfc764a6d673d6ecaa187e20
parent4225f51c62b69f12e51151c2c73245342890f794 (diff)
downloadffmpeg-90e28331c7887b83d7c508bea71735ae12dad177.tar.gz
avcodec/png: more informative error message for invalid sBIT size
If the sBIT chunk size is invalid, we should print a more informative error message rather than return an error and print nothing. Signed-off-by: Leo Izen <leo.izen@gmail.com>
-rw-r--r--libavcodec/pngdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index b0d02c97dd..cb861e5f60 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1086,8 +1086,11 @@ static int decode_sbit_chunk(AVCodecContext *avctx, PNGDecContext *s,
channels = s->color_type & PNG_COLOR_MASK_PALETTE ? 3 : ff_png_get_nb_channels(s->color_type);
- if (bytestream2_get_bytes_left(gb) != channels)
+ if (bytestream2_get_bytes_left(gb) != channels) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid sBIT size: %d, expected: %d\n",
+ bytestream2_get_bytes_left(gb), channels);
return AVERROR_INVALIDDATA;
+ }
for (int i = 0; i < channels; i++) {
int b = bytestream2_get_byteu(gb);