mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
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>
This commit is contained in:
parent
09c1c0b126
commit
6a8cf7b383
@ -1025,8 +1025,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);
|
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;
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < channels; i++) {
|
for (int i = 0; i < channels; i++) {
|
||||||
int b = bytestream2_get_byteu(gb);
|
int b = bytestream2_get_byteu(gb);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user