From aca378f51ecf682ea1454071f671bbc7eef808bd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 31 Oct 2017 18:11:10 -0600 Subject: [PATCH] Sanitize (Headless)ArrayOf()::len to ensure it doesn't use offsets --- src/hb-open-type-private.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 7a62dcb84..e41e7451f 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -946,7 +946,7 @@ struct ArrayOf inline bool sanitize_shallow (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - return_trace (c->check_struct (this) && c->check_array (array, Type::static_size, len)); + return_trace (len.sanitize (c) && c->check_array (array, Type::static_size, len)); } public: @@ -1033,7 +1033,7 @@ struct HeadlessArrayOf inline bool sanitize_shallow (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - return_trace (c->check_struct (this) && + return_trace (len.sanitize (c) && (!len || c->check_array (array, Type::static_size, len - 1))); }