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 D299E4A568 for ; Fri, 29 Mar 2024 19:32:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 23E8468D251; Fri, 29 Mar 2024 21:32:33 +0200 (EET) 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 0C48D68D219 for ; Fri, 29 Mar 2024 21:32:24 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 3BC7E60003 for ; Fri, 29 Mar 2024 19:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1711740744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:in-reply-to:in-reply-to:references:references; bh=pWa/0ARTUkcVAmMiqEJMIMlYYX+Ee5vMS0vsXLCphUA=; b=cUV+jjAIvx/3eTWCKKCcXujQWKlTXbZAsURO4m0iBrAAjJ7qsrcAH8pihO6od6Inb5BTkV eq5msfCgCsspE6UqdU9EvbPxwd8aJGxKzGP4wBnPH8XNTeGsUORnL2Thqr+urnhI/3gjUf 5C+bBjG2KiqUn2xkaaYxFxzMRT71xfeZ0m+JYz/X10HtW1HtFcQ4le2hxWu6lnj5QYcp/2 z2mVpqMaEtm2ShjNJCoW3cPVeQOHPJq8Feb61pzbHB5tSN4ymdTgtxQken8TXhEo9zJb1z foSvfTAq/bmIA+XH9JwLuMgHeZJmj4M/UQGlj17jYfM8N76GE12cnPgif6PKxQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 29 Mar 2024 20:32:21 +0100 Message-Id: <20240329193221.11522-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240329193221.11522-1-michael@niedermayer.cc> References: <20240329193221.11522-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/3] avformat/mxfdec: Check first case of offset_temp computation for overflow 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: This is kind of ugly Fixes: signed integer overflow: 255 * 1157565362826411919 cannot be represented in type 'long' Fixes: 67313/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6250434245230592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mxfdec.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index c9af4628555..fe86f516630 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1891,9 +1891,14 @@ static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_t if (edit_unit < s->index_start_position + s->index_duration) { int64_t index = edit_unit - s->index_start_position; - if (s->edit_unit_byte_count) + if (s->edit_unit_byte_count) { + if (s->edit_unit_byte_count * (uint64_t)index / s->edit_unit_byte_count != index || + s->edit_unit_byte_count * index > INT64_MAX - offset_temp + ) + return AVERROR_INVALIDDATA; + offset_temp += s->edit_unit_byte_count * index; - else { + } else { if (s->nb_index_entries == 2 * s->index_duration + 1) index *= 2; /* Avid index */ -- 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".