1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:07:36 +00:00

LibGfx: Fix dynamic bitmasks in BMPs

I overlooked a corner case where we might call the built-in ctz() on zero.

Furthermore, the calculation of the shift was wrong and the results were often
unusable.

Both issue were caused by a forgotten 36daeee34f.
This time I made sure to look at bmpsuite_files first, and now they look good.

Found by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28985
This commit is contained in:
Ben Wiederhake 2021-01-30 01:24:41 +01:00 committed by Andreas Kling
parent 648f153951
commit 4332dfb964
2 changed files with 16 additions and 3 deletions

View file

@ -81,9 +81,16 @@ ALWAYS_INLINE int count_trailing_zeroes_32(unsigned int val)
}
return 0;
#endif
}
ALWAYS_INLINE int count_trailing_zeroes_32_safe(unsigned int val)
{
if (val == 0)
return 32;
return count_trailing_zeroes_32(val);
}
#ifdef AK_OS_BSD_GENERIC
# define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC
# define CLOCK_REALTIME_COARSE CLOCK_REALTIME
#endif
}