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
Notes:
sideshowbarker
2024-07-17 05:09:48 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/18064fdb92 Pull-request: https://github.com/SerenityOS/serenity/pull/17652 Reviewed-by: https://github.com/linusg Reviewed-by: https://github.com/nico ✅
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)
|
||||
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
Reference in a new issue