From 005389beb5a28e2a94b40d0bb8229e9598b84b1d Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 3 Sep 2019 17:00:46 +0430 Subject: [PATCH] Use hb_parse_uint in deserializer token parser --- src/hb-buffer-serialize.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hb-buffer-serialize.cc b/src/hb-buffer-serialize.cc index 5f65d314f..bc27f78f8 100644 --- a/src/hb-buffer-serialize.cc +++ b/src/hb-buffer-serialize.cc @@ -396,9 +396,12 @@ parse_int (const char *pp, const char *end, int32_t *pv) static bool parse_uint (const char *pp, const char *end, uint32_t *pv) { - int32_t v; - if (!parse_int (pp, end, &v)) - return false; + unsigned int v; + const char *p = pp; + if (unlikely (!hb_parse_uint (&p, end, &v))) return false; + + /* Check if parser consumed all of the buffer */ + if (unlikely (p != end)) return false; *pv = v; return true;