From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 2F12A44DCD for ; Tue, 22 Nov 2022 22:57:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 898A168BB95; Wed, 23 Nov 2022 00:57:00 +0200 (EET) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E2F1668B5F8 for ; Wed, 23 Nov 2022 00:56:53 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 432891BF205 for ; Tue, 22 Nov 2022 22:56:52 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 22 Nov 2022 23:56:51 +0100 Message-Id: <20221122225652.1341-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/pictordec: Check that the image fits in the input X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 --- 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".