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 B1B4E42AF6 for ; Sat, 10 Sep 2022 22:32:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1231368BB2E; Sun, 11 Sep 2022 01:32:54 +0300 (EEST) Received: from vie01a-dmta-at01-3.mx.upcmail.net (vie01a-dmta-at01-3.mx.upcmail.net [62.179.121.147]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 75A6D68BB1B for ; Sun, 11 Sep 2022 01:32:48 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at01.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1oX91s-005JK1-0E for ffmpeg-devel@ffmpeg.org; Sun, 11 Sep 2022 00:32:48 +0200 Received: from ren-mail-psmtp-mg01. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id X90uoAs7S8s8UX90uopKvY; Sun, 11 Sep 2022 00:31:48 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg01. with ESMTP id X8zwoDe67OPqFX8zwo6P1H; Sun, 11 Sep 2022 00:30:48 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.4 cv=OcX7sjfY c=1 sm=1 tr=0 ts=631d1018 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=NEAV23lmAAAA:8 a=qXCkH0IT268N9l7CK0gA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 11 Sep 2022 00:30:44 +0200 Message-Id: <20220910223046.5135-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220910223046.5135-1-michael@niedermayer.cc> References: <20220910223046.5135-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfNX4jS6NlX3VyGiJOMPyJN4LSehmqEuxKgpuswazMw/EvOo5z5jWxXTkyWqOtnavWp6Nc5wg3+6MvXQNlRHcTv7xbelFGdudh3ICIvX6glhWErGs9QA4 ciOoFpfOpjLLfwQK0pKjbdSKju8A/AilGTXYzFwDMP/J3gHtpOtryr2b6WuB2Ai3O4gCuNyoIGT1rQ== Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/exr: Check preview psize 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: signed integer overflow: 17121181824 * 538976288 cannot be represented in type 'long long' Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5915330316206080 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/exr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 235f6fa6cdd..c924406f131 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1942,9 +1942,12 @@ static int decode_header(EXRContext *s, AVFrame *frame) "preview", 16)) >= 0) { uint32_t pw = bytestream2_get_le32(gb); uint32_t ph = bytestream2_get_le32(gb); - int64_t psize = 4LL * pw * ph; + uint64_t psize = pw * ph; + if (psize > INT64_MAX / 4) + return AVERROR_INVALIDDATA; + psize *= 4; - if (psize >= bytestream2_get_bytes_left(gb)) + if ((int64_t)psize >= bytestream2_get_bytes_left(gb)) return AVERROR_INVALIDDATA; bytestream2_skip(gb, psize); -- 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".