mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:08:10 +00:00
LibGfx: Bounds check component indices before using them in JPGLoader
With this, I don't see any crashes in 10 min of fuzzing (but still get OOMs).
This commit is contained in:
parent
a8318b15a7
commit
7042490e41
1 changed files with 6 additions and 0 deletions
|
@ -296,6 +296,12 @@ static bool build_macroblocks(JPGLoadingContext& context, Vector<Macroblock>& ma
|
|||
{
|
||||
for (u32 cindex = 0; cindex < context.component_count; cindex++) {
|
||||
auto& component = context.components[cindex];
|
||||
|
||||
if (component.dc_destination_id >= context.dc_tables.size())
|
||||
return false;
|
||||
if (component.ac_destination_id >= context.ac_tables.size())
|
||||
return false;
|
||||
|
||||
for (u8 vfactor_i = 0; vfactor_i < component.vsample_factor; vfactor_i++) {
|
||||
for (u8 hfactor_i = 0; hfactor_i < component.hsample_factor; hfactor_i++) {
|
||||
u32 mb_index = (vcursor + vfactor_i) * context.mblock_meta.hpadded_count + (hfactor_i + hcursor);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue