mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 21:12:26 +00:00
LibGfx/WebPWriter: Do not convert -inf to unsigned
Else UBSan complains about the color indexing test in this PR.
This commit is contained in:
parent
9e61912f64
commit
47d3245ea7
Notes:
sideshowbarker
2024-07-17 04:32:07 +09:00
Author: https://github.com/nico
Commit: 47d3245ea7
Pull-request: https://github.com/SerenityOS/serenity/pull/24483
Reviewed-by: https://github.com/gmta ✅
1 changed files with 1 additions and 1 deletions
|
@ -206,7 +206,7 @@ static ErrorOr<CanonicalCode> write_normal_code_lengths(LittleEndianOutputBitStr
|
|||
// "int length_nbits = 2 + 2 * ReadBits(3);
|
||||
// int max_symbol = 2 + ReadBits(length_nbits);"
|
||||
// => length_nbits is at most 2 + 2*7 == 16
|
||||
unsigned needed_length_nbits = floor(log2(encoded_lengths_count - 2) + 1);
|
||||
unsigned needed_length_nbits = encoded_lengths_count > 2 ? floor(log2(encoded_lengths_count - 2) + 1) : 2;
|
||||
VERIFY(needed_length_nbits <= 16);
|
||||
needed_length_nbits = ceil_div(needed_length_nbits, 2) * 2;
|
||||
TRY(bit_stream.write_bits((needed_length_nbits - 2) / 2, 3u));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue