mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-23 02:55:15 +00: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
|
@ -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 a new issue