From patchwork Fri Sep 29 23:19:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 44039 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1204:b0:15d:8365:d4b8 with SMTP id v4csp97694pzf; Fri, 29 Sep 2023 16:20:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEoOSUgiNeYUb69sUm4I4mg1CxabkoB/XUtICWyYnfiJOzBTEE+4uTu1vhp60A7TWx7GUCG X-Received: by 2002:a17:906:3098:b0:9ae:7088:6e5d with SMTP id 24-20020a170906309800b009ae70886e5dmr5500381ejv.3.1696029625364; Fri, 29 Sep 2023 16:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696029625; cv=none; d=google.com; s=arc-20160816; b=cS6kj2NEquux/C/J1JbwCr244VERC0kJvGTHJIItgJTGV4aGt9zSjyfUyc9kXpOB/P aLIWtaMgnHmSq8r3igSb3YyXZexB15jSwgvVUU5gxre36FAVyx7RgrkgVDbShJ0iGj6k Kke/dAVZ1pFIpcn061WZj9zn0aeCson5rKJI81Am6pIZQj42oW8DSFvbnH+887fYXFKb 1/EzmMM42DQaJI58EjzUwM2zc3AHlcmjoLUTxvsYyYzR9BWJYQPCcNmwjyJ37S59j7TG uYCu4hRPQ8GMWCDe+C5iD1eF673U1DwnRqR6yJLramkU/qh19NTn+n8AQW2xkyP5D2LJ W1rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=WEWPCxJkGtKd1wgpYknYjxL+FaV4WMgjEIKlzX90aIc=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=dWZmsoAmo9HHU+Hm6ibfDoo5UEwkeVewdbxrOEU9DENBQfiR2Q+G6bn0x/r0aEONvI XQxNJUa6a97RpDA1YMcCdhnVstX+105+0IKcppncfC+G0RPoZxy/a6iHjA5DMN9gx0PH uPNsK3s9XInmlaJKGYZ21b9vbnbyyrMp7aFhIpmYjbBLDYnZt0zfXzdr6PWHMgwg28lV KxKMjMcaMLxVJ4ZFxNcovhm4XaQ/xU0vPpjvAdeYwD1vIW9tjORcd+uCo1Uh2BAoY5LI rkoiv9nPUnDlcP79HBwzlgXjuiCsbAB0yHT9Cl2zjkJ+8hmBUgbDfAPjVHWNl+9GzYbf KwBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bl21-20020a170906c25500b0098dfdc3f2d9si15901458ejb.342.2023.09.29.16.20.25; Fri, 29 Sep 2023 16:20:25 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 078C368CCA8; Sat, 30 Sep 2023 02:20:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C0F4168CBDD for ; Sat, 30 Sep 2023 02:20:04 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id E77CD1C0005 for ; Fri, 29 Sep 2023 23:20:03 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 30 Sep 2023 01:19:57 +0200 Message-Id: <20230929232001.23197-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230929232001.23197-1-michael@niedermayer.cc> References: <20230929232001.23197-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/6] avformat/avidec: Correct unsigend type 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 9w/oJ+S8ctrJ Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long long' Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6706191715139584 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/avidec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index cfc693842b7..95a6cbe930e 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1704,7 +1704,7 @@ static int check_stream_max_drift(AVFormatContext *s) int *idx = av_calloc(s->nb_streams, sizeof(*idx)); if (!idx) return AVERROR(ENOMEM); - for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1LU) { + for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1llu) { int64_t max_dts = INT64_MIN / 2; int64_t min_dts = INT64_MAX / 2; int64_t max_buffer = 0;