From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 7E9D24CFCD for <ffmpegdev@gitmailbox.com>; Sun, 16 Mar 2025 12:52:36 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D52E568D113; Sun, 16 Mar 2025 14:52:33 +0200 (EET) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1179968D113 for <ffmpeg-devel@ffmpeg.org>; Sun, 16 Mar 2025 14:52:27 +0200 (EET) Received: from haasn.dev (unknown [10.30.1.1]) by haasn.dev (Postfix) with UTF8SMTP id 5E375410B5; Sun, 16 Mar 2025 13:52:26 +0100 (CET) From: Niklas Haas <ffmpeg@haasn.xyz> To: ffmpeg-devel@ffmpeg.org Date: Sun, 16 Mar 2025 13:52:23 +0100 Message-ID: <20250316125224.7616-1-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] swscale: fix gray -> grayf32 SIGFPE X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Cc: Niklas Haas <git@haasn.dev> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250316125224.7616-1-ffmpeg@haasn.xyz/> List-Archive: <https://master.gitmailbox.com/ffmpegdev/> List-Post: <mailto:ffmpegdev@gitmailbox.com> From: Niklas Haas <git@haasn.dev> swscale internals don't distinguish between 16-bit and higher bit depth output formats internally when it comes to the choice of intermediate representation. Clamping this value both prevents a SIGFPE and also aligns the check with reality. --- libswscale/swscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 98f94d029f..65ed654ebd 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -586,7 +586,7 @@ static void solve_range_convert(uint16_t src_min, uint16_t src_max, static void init_range_convert_constants(SwsInternal *c) { - const int bit_depth = c->dstBpc ? c->dstBpc : 8; + const int bit_depth = c->dstBpc ? FFMIN(c->dstBpc, 16) : 8; const int src_bits = bit_depth <= 14 ? 15 : 19; const int src_shift = src_bits - bit_depth; const int mult_shift = bit_depth <= 14 ? 14 : 18; -- 2.48.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".