From 70eb2ff682344688635cebb716fee0b73557c925 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 2 Dec 2016 19:51:23 -0800 Subject: [PATCH] Check for offset overflows during sanitize --- src/hb-open-type-private.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 6b643784e..66f1c08df 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -806,6 +806,7 @@ struct OffsetTo : Offset 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 (base, offset); return_trace (likely (obj.sanitize (c)) || neuter (c)); } @@ -816,6 +817,7 @@ struct OffsetTo : Offset 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 (base, offset); return_trace (likely (obj.sanitize (c, user_data)) || neuter (c)); }