mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
LibGfx: Fail JPEG decode instead of asserting on bogus start-of-scan
Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28628
This commit is contained in:
parent
0fc8561029
commit
cd046fae44
1 changed files with 4 additions and 1 deletions
|
@ -552,7 +552,10 @@ static bool read_start_of_scan(InputMemoryStream& stream, JPGLoadingContext& con
|
||||||
auto it = context.components.find(component_id);
|
auto it = context.components.find(component_id);
|
||||||
if (it != context.components.end()) {
|
if (it != context.components.end()) {
|
||||||
component = &it->value;
|
component = &it->value;
|
||||||
ASSERT(i == component->serial_id);
|
if (i != component->serial_id) {
|
||||||
|
dbgln("JPEG decode failed (i != component->serial_id)");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifdef JPG_DEBUG
|
#ifdef JPG_DEBUG
|
||||||
dbg() << stream.offset() << String::format(": Unsupported component id: %i!", component_id);
|
dbg() << stream.offset() << String::format(": Unsupported component id: %i!", component_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue