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 C03A54845A for ; Fri, 3 May 2024 16:36:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E253D68D6DF; Fri, 3 May 2024 19:36:41 +0300 (EEST) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 06B8868D680 for ; Fri, 3 May 2024 19:36:34 +0300 (EEST) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-41ba1ba55ebso55895175e9.1 for ; Fri, 03 May 2024 09:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714754194; x=1715358994; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=SfPmzGyZQT6nmUoyt03KU+rpDbPyhizNtW886lPHDrk=; b=cwXuj0SFDPxX8cBtWEtyXYv2R4ncUJS7sBFQUKZeOSyb6nWyZscb+Axt+/L46Ba/lp TSin2HUBNexMTfRuQjx/rs8VV6LCvHBmwr0En/hxwrjoBVE8nbmt/HjXIEKNTpV8vnHk nusg38wQqerpdF4xzy5WDT0yiUNfnoYGRLQzvszmtBh2OgqiRqWeHuZa1wM861y66qL/ ViPglFTvAYq0uioB+rro/t8DOGkCU/RVUp3Ynce1b+kYZm73cdpG2vOG21J7LadpulXH IGg13tCUxpjGG32oN8kuRV/gwRWVXUVhOOCAWH/+4J9gyHuKqlI6bPk0n1u1X+4vxnT3 NwmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714754194; x=1715358994; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SfPmzGyZQT6nmUoyt03KU+rpDbPyhizNtW886lPHDrk=; b=V3/C0ZNLoUS/+wdWJ6HrcDbI+O8dnW9LUGlcINnloL10JU5vhtgj6IJ+9TrPSzYnIT 3NOjYT8o9sLYdQm1NQz5p7jaSF5YIogc0xPNnjQLVMPIc8K+Kqrvkh8/RqNGjZW6sJK6 zMj/6ho5xzcC78gaaRyXTWxQ4Ij5WquAd8Oqyb3IhrWV2WGhB+3++CrE4dEZ2yOORuTU 0JR3SQQVYrMWDAmTzp+nf/GZ3snVElhoVxDKjRoCH+OSlXmNczxvz90e0rjhvrqZkXOF HA9hhN73yRaK9iJHTnveexhl5zZ4V1jy3Ah6bYTl/C70CjJLw6AQL6IRPUsXZbuwQL+a Egpw== X-Gm-Message-State: AOJu0YykVFpwLUnvK6N3w6knnFr2cLDBp1oIRFDH31tujy40kdRyNp0E E1IEEmYrkyhqFF3ny78NmtIYJ9eZhLp1Tfff2p2mYqZCnsL/W5Hblk2aNw== X-Google-Smtp-Source: AGHT+IFrdnjVuwFQfygN+cbuUtmvVMDWowHlMmAAO1xTTJNvYGD/CHozKZz6qchURng5xUdDOpuvuw== X-Received: by 2002:a05:600c:35c7:b0:416:3f85:d49 with SMTP id r7-20020a05600c35c700b004163f850d49mr2683397wmq.18.1714754193465; Fri, 03 May 2024 09:36:33 -0700 (PDT) Received: from localhost.localdomain (33bf0029.skybroadband.com. [51.191.0.41]) by smtp.gmail.com with ESMTPSA id p17-20020a05600c359100b0041adf358058sm6084841wmq.27.2024.05.03.09.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 09:36:32 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Fri, 3 May 2024 17:36:23 +0100 Message-ID: <20240503163623.376990-1-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] fftools/ffprobe: Avoid overflow when calculating DAR 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: Both the codecpar's width and height, and the SAR num and den are ints, which can overflow. Cast to int64_t, which is what av_reduce takes. Without this, occasionally, display_aspect_ratio can be negative in ffprobe's -show_stream output. Signed-off-by: Derek Buitenhuis --- fftools/ffprobe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 0d4cd0b048..5b40dad527 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -3324,8 +3324,8 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id if (sar.num) { print_q("sample_aspect_ratio", sar, ':'); av_reduce(&dar.num, &dar.den, - par->width * sar.num, - par->height * sar.den, + (int64_t) par->width * sar.num, + (int64_t) par->height * sar.den, 1024*1024); print_q("display_aspect_ratio", dar, ':'); } else { -- 2.43.0 _______________________________________________ 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".