mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-26 14:57:54 +03:00
LibGfx/JPEG: Refill reservoir if necessary when discarding bits
This condition was hit 157 times out of the 109,233 JPEG images in the Govdocs1 corpus. This change allows all of these images to load correctly.
This commit is contained in:
parent
4c5d48f861
commit
438e9e146c
Notes:
sideshowbarker
2024-07-17 02:06:40 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/438e9e146c Pull-request: https://github.com/SerenityOS/serenity/pull/21767 Reviewed-by: https://github.com/LucasChollet ✅
@ -270,7 +270,8 @@ TEST_CASE(test_jpeg_malformed_header)
|
||||
TEST_CASE(test_jpeg_malformed_frame)
|
||||
{
|
||||
Array test_inputs = {
|
||||
TEST_INPUT("jpg/oss-fuzz-testcase-62584.jpg"sv)
|
||||
TEST_INPUT("jpg/oss-fuzz-testcase-62584.jpg"sv),
|
||||
TEST_INPUT("jpg/oss-fuzz-testcase-63815.jpg"sv)
|
||||
};
|
||||
|
||||
for (auto test_input : test_inputs) {
|
||||
|
BIN
Tests/LibGfx/test-inputs/jpg/oss-fuzz-testcase-63815.jpg
Normal file
BIN
Tests/LibGfx/test-inputs/jpg/oss-fuzz-testcase-63815.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
@ -296,11 +296,8 @@ public:
|
||||
{
|
||||
m_bit_offset += count;
|
||||
|
||||
if (m_bit_offset > bits_in_reservoir) {
|
||||
// FIXME: I can't find a test case for that so let's leave it for later
|
||||
// instead of inserting an hard-to-find bug.
|
||||
TODO();
|
||||
}
|
||||
if (m_bit_offset > bits_in_reservoir)
|
||||
TRY(refill_reservoir());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user