mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
LibGfx/JPEG: Don't call add_ac
if not necessary
Calling it was harmless as add_ac iterates over the spectral selection, hence it won't do anything if not needed. However, this patch remains useful as it prevents dereferencing the iterator returned by find, in case the AC table isn't defined yet. This case happens with SOF2 images and is (pretty harmless as read only but still) undefined behavior.
This commit is contained in:
parent
1926a86336
commit
18064fdb92
1 changed files with 2 additions and 1 deletions
|
@ -443,7 +443,8 @@ static ErrorOr<void> build_macroblocks(JPEGLoadingContext& context, Vector<Macro
|
||||||
|
|
||||||
if (context.current_scan.spectral_selection_start == 0)
|
if (context.current_scan.spectral_selection_start == 0)
|
||||||
TRY(add_dc(context, block, scan_component));
|
TRY(add_dc(context, block, scan_component));
|
||||||
TRY(add_ac(context, block, scan_component));
|
if (context.current_scan.spectral_selection_end != 0)
|
||||||
|
TRY(add_ac(context, block, scan_component));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue