LibGfx/JPEGWriter: Fix crash on macOS when csize coefficient is 0

This fixes #21108
This commit is contained in:
Nicolas Ramz 2023-10-06 11:55:20 +02:00 committed by Andreas Kling
commit 68e916490b
Notes: sideshowbarker 2024-07-17 03:59:29 +09:00
3 changed files with 9 additions and 5 deletions

View file

@ -326,6 +326,10 @@ private:
static u8 csize(i16 coefficient)
{
VERIFY(coefficient >= -2047 && coefficient <= 2047);
if (coefficient == 0)
return 0;
return floor(log2(abs(coefficient))) + 1;
}