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 6442C450AB for ; Thu, 2 May 2024 00:43:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B975468D787; Thu, 2 May 2024 03:42:06 +0300 (EEST) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B6DEE68D76D for ; Thu, 2 May 2024 03:41:58 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id EF71A60002 for ; Thu, 2 May 2024 00:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1714610518; 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=o8zSVVxNfOT9g4WBPDJOjrlknef83xxP+rbyfLVSMmU=; b=d5SYZ50hg04Ayb8khx2UNcBx36z/HORrPItvZmt/KbMrvAgwRQNGHCxClRA4akgfHZR2mb 24QfNsXYFiPydgZttjTuD6xpv6ldrmygU3rjPmhKWfTLOWxnmczpfnqeZSJIPNm45Tn1UU VUMRxQCJ53IP/dxH0tnrPq6lqj8CCBQ7rhb8MU305RCS0o2H5Gc3b4xzCCT045LMKSkwS8 lu/dwHwBcVbHnmK47SpWAb3wAPVY3Jg88o+7JovlV0KcUES70PNvz33z6QU6DsO4weIq5B 4a+jrt6BF+Ie63wG9E74pw61q3ExK6RhNlhPejat0taCIu5Q6hhIG0GGfZR2pw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 2 May 2024 02:41:50 +0200 Message-ID: <20240502004150.3627661-7-michael@niedermayer.cc> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240502004150.3627661-1-michael@niedermayer.cc> References: <20240502004150.3627661-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 7/7] avcodec/cbs_jpeg: Try to move the read entity to one side in a test 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: CID1439654 Untrusted pointer read Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavcodec/cbs_jpeg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/cbs_jpeg.c b/libavcodec/cbs_jpeg.c index b1b58dcd65e..406147c082c 100644 --- a/libavcodec/cbs_jpeg.c +++ b/libavcodec/cbs_jpeg.c @@ -146,13 +146,13 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx, } } else { i = start; - if (i + 2 > frag->data_size) { + if (i > frag->data_size - 2) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid JPEG image: " "truncated at %02x marker.\n", marker); return AVERROR_INVALIDDATA; } length = AV_RB16(frag->data + i); - if (i + length > frag->data_size) { + if (length > frag->data_size - i) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid JPEG image: " "truncated at %02x marker segment.\n", marker); return AVERROR_INVALIDDATA; -- 2.43.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".