ffmpeg | branch: release/7.0 | Leo Izen <leo.i...@gmail.com> | Fri Jul 12 
15:03:17 2024 -0400| [daffde0544aa7db7964d7a9dc8e36cee831709f7] | committer: 
Leo Izen

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.i...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=daffde0544aa7db7964d7a9dc8e36cee831709f7
---

 libavcodec/pngdec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 8a881963b5..ac39b3277b 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1084,8 +1084,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);

_______________________________________________
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".

Reply via email to