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 4F1BB4988E for ; Thu, 20 Jun 2024 19:35:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 321AA68D895; Thu, 20 Jun 2024 22:35:18 +0300 (EEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5DDBD68D88B for ; Thu, 20 Jun 2024 22:35:09 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 98CB2240002 for ; Thu, 20 Jun 2024 19:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1718912108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tRo22XWi7HkvzLPqkQdUMtcuenh6914M8KbqR6VkX+s=; b=eDYNVhR7aOVVg0IMIvmpRers2VdMoPwb0/098/4o4WNGP5kpTm9cI9mbRKcQc6AkY/LvgQ JazvLa7Qh4H5m7cf0ca3VSwZcBtrkpUUXjkhAStbrs/dbwxdnd+pH+d0E3zRQVsjk2I1WH h1xBv8YUBFo4JTPlAI2Hvw+qz/R7P1U5aGz7HX5PmQFJiSOzNRPeiMeWqWU8GW2Atf8gIi mWIyEqhhznYkvihBZ53t7TRe//ZqJh7NVUfDOm1xIqFOKvl05PS0qA95ZfXUf7Lby+ys/1 OPC5NoyZOlp4Hd2OAp4eb3o7cCow1J0m9UGqlCjNMs4EShll1Slpl9OY176PLA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 20 Jun 2024 21:35:04 +0200 Message-ID: <20240620193504.2310780-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240620193504.2310780-1-michael@niedermayer.cc> References: <20240620193504.2310780-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 4/4] avcodec/mpegvideo_enc: Do not duplicate pictures on shifting 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 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: out of array access Fixes: 69098/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG2VIDEO_fuzzer-6107989688778752 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo_enc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index eda23056301..dc9a0009f53 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1266,6 +1266,8 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) /* shift buffer entries */ for (int i = flush_offset; i <= MAX_B_FRAMES; i++) s->input_picture[i - flush_offset] = s->input_picture[i]; + for (int i = MAX_B_FRAMES + 1 - flush_offset; i <= MAX_B_FRAMES; i++) + s->input_picture[i] = NULL; s->input_picture[encoding_delay] = pic; -- 2.45.2 _______________________________________________ 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".