ffmpeg | branch: master | Niklas Haas <g...@haasn.dev> | Fri Mar  7 19:36:29 
2025 +0100| [8ab40ca984fa123e5aa8c45ec5d9fdadb1b12cb6] | committer: Niklas Haas

swscale: fix gray -> grayf32 SIGFPE

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8ab40ca984fa123e5aa8c45ec5d9fdadb1b12cb6
---

 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;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to