Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] avcodec/pictordec: Check that the image fits in the input
@ 2022-11-22 22:56 Michael Niedermayer
  2022-11-22 22:56 ` [FFmpeg-devel] [PATCH 2/2] avcodec/ffv1dec: restructure slice coordinate reading a bit Michael Niedermayer
  2022-11-25  6:45 ` [FFmpeg-devel] [PATCH 1/2] avcodec/pictordec: Check that the image fits in the input Peter Ross
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Niedermayer @ 2022-11-22 22:56 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: Timeout
Fixes: 53438/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PICTOR_fuzzer-5458939919859712

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpe
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/pictordec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c
index 71bad40a0a..09229b94fd 100644
--- a/libavcodec/pictordec.c
+++ b/libavcodec/pictordec.c
@@ -162,6 +162,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
 
     if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
         return -1;
+    if (bytestream2_get_bytes_left(&s->g) < s->width * s->height / 65536 * 5)
+        return AVERROR_INVALIDDATA;
+
     if (s->width != avctx->width || s->height != avctx->height) {
         ret = ff_set_dimensions(avctx, s->width, s->height);
         if (ret < 0)
-- 
2.17.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-27 22:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22 22:56 [FFmpeg-devel] [PATCH 1/2] avcodec/pictordec: Check that the image fits in the input Michael Niedermayer
2022-11-22 22:56 ` [FFmpeg-devel] [PATCH 2/2] avcodec/ffv1dec: restructure slice coordinate reading a bit Michael Niedermayer
2022-11-27 22:37   ` Michael Niedermayer
2022-11-25  6:45 ` [FFmpeg-devel] [PATCH 1/2] avcodec/pictordec: Check that the image fits in the input Peter Ross
2022-11-25 13:38   ` Michael Niedermayer
2022-11-25 14:11     ` Anton Khirnov
2022-11-25 23:42       ` Peter Ross
2022-11-27 22:43         ` Michael Niedermayer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git