mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-25 08:51:07 +01:00
Check for offset overflows during sanitize
This commit is contained in:
1 parent
4b58c9e326
commit
70eb2ff682
1 file changed
+2
@@ -806,6 +806,7 @@ struct OffsetTo : Offset<OffsetType>
|
||||
if (unlikely (!c->check_struct (this))) return_trace (false);
|
||||
unsigned int offset = *this;
|
||||
if (unlikely (!offset)) return_trace (true);
|
||||
if (unlikely (!c->check_range (base, offset))) return_trace (false);
|
||||
const Type &obj = StructAtOffset<Type> (base, offset);
|
||||
return_trace (likely (obj.sanitize (c)) || neuter (c));
|
||||
}
|
||||
@@ -816,6 +817,7 @@ struct OffsetTo : Offset<OffsetType>
|
||||
if (unlikely (!c->check_struct (this))) return_trace (false);
|
||||
unsigned int offset = *this;
|
||||
if (unlikely (!offset)) return_trace (true);
|
||||
if (unlikely (!c->check_range (base, offset))) return_trace (false);
|
||||
const Type &obj = StructAtOffset<Type> (base, offset);
|
||||
return_trace (likely (obj.sanitize (c, user_data)) || neuter (c));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user