mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
LibGfx: Accept BMP RLE of 255 repeated bytes
Previously, in the case of RLE4, parsing took suspiciously long. What happened was that 'pixel_count' was 255, and 'i' was incremented by *two* in each iteration, so the for-loop continued until the entire output buffer was full, and then rejected the RLE data as bogus. This little diff allows pixel_count to reach 256, be greater than pixel_count, and thus terminate the loop in the intended way.
This commit is contained in:
parent
21977a2188
commit
aec8983819
Notes:
sideshowbarker
2024-07-19 01:05:23 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/aec8983819f Pull-request: https://github.com/SerenityOS/serenity/pull/4308
1 changed files with 1 additions and 1 deletions
|
@ -1059,7 +1059,7 @@ static bool uncompress_bmp_rle_data(BMPLoadingContext& context, ByteBuffer& buff
|
|||
if (!result.has_value())
|
||||
return false;
|
||||
byte = result.value();
|
||||
for (u8 i = 0; i < pixel_count; ++i) {
|
||||
for (u16 i = 0; i < pixel_count; ++i) {
|
||||
if (compression != Compression::RLE4) {
|
||||
if (!set_byte(byte, true))
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue