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 5130144D7F for ; Mon, 21 Nov 2022 23:58:51 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 576EE68BAF0; Tue, 22 Nov 2022 01:58:33 +0200 (EET) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0EC4A68BAC7 for ; Tue, 22 Nov 2022 01:58:26 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 34AAAFF803 for ; Mon, 21 Nov 2022 23:58:25 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 22 Nov 2022 00:58:23 +0100 Message-Id: <20221121235823.28468-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221121235823.28468-1-michael@niedermayer.cc> References: <20221121235823.28468-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/dts2pts_bsf: Eliminate some 64bit corner cases 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: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: 53364/clusterfuzz-testcase-minimized-ffmpeg_BSF_DTS2PTS_fuzzer-4693772269387776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dts2pts_bsf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/dts2pts_bsf.c b/libavcodec/dts2pts_bsf.c index 8142562d2c..522d5e1eb0 100644 --- a/libavcodec/dts2pts_bsf.c +++ b/libavcodec/dts2pts_bsf.c @@ -301,15 +301,15 @@ static int h264_filter(AVBSFContext *ctx) if (output_picture_number != h264->last_poc) { if (h264->last_poc != INT_MIN) { - int diff = FFABS(h264->last_poc - output_picture_number); + int64_t diff = FFABS(h264->last_poc - (int64_t)output_picture_number); if ((output_picture_number < 0) && !h264->last_poc) h264->poc_diff = 0; - else if (FFABS(output_picture_number) < h264->poc_diff) { + else if (FFABS((int64_t)output_picture_number) < h264->poc_diff) { diff = FFABS(output_picture_number); h264->poc_diff = 0; } - if (!h264->poc_diff || (h264->poc_diff > diff)) { + if ((!h264->poc_diff || (h264->poc_diff > diff)) && diff <= INT_MAX) { h264->poc_diff = diff; if (h264->poc_diff == 1 && h264->sps.frame_mbs_only_flag) { av_tree_enumerate(s->root, &h264->poc_diff, NULL, dec_poc); -- 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".