diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2024-04-25 11:17:54 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2024-04-26 01:45:55 +0200 |
commit | 9ecb468aec3ec0d649587007786475d9a9974a30 (patch) | |
tree | cc8a1370e98304bacf263fa831b03989f0d23c26 /src/3rdparty/harfbuzz-ng/src/hb-ot-cff-common.hh | |
parent | ca843efbf681b997882758b6bd2f5b75cc5be976 (diff) |
Update Harfbuzz to 8.4.0
Pick-to: 5.15 6.2 6.5 6.7 6.7.1
Fixes: QTBUG-124757
Change-Id: I1fa9259c2f7cb45b4dcec8956c2186735c89fb95
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-ot-cff-common.hh')
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/hb-ot-cff-common.hh | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-cff-common.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-cff-common.hh index 4fdba197ac..c7c3264c08 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-ot-cff-common.hh +++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-cff-common.hh @@ -41,10 +41,21 @@ using namespace OT; using objidx_t = hb_serialize_context_t::objidx_t; using whence_t = hb_serialize_context_t::whence_t; -/* utility macro */ -template<typename Type> -static inline const Type& StructAtOffsetOrNull (const void *P, unsigned int offset) -{ return offset ? StructAtOffset<Type> (P, offset) : Null (Type); } +/* CFF offsets can technically be negative */ +template<typename Type, typename ...Ts> +static inline const Type& StructAtOffsetOrNull (const void *P, int offset, hb_sanitize_context_t &sc, Ts&&... ds) +{ + if (!offset) return Null (Type); + + const char *p = (const char *) P + offset; + if (!sc.check_point (p)) return Null (Type); + + const Type &obj = *reinterpret_cast<const Type *> (p); + if (!obj.sanitize (&sc, std::forward<Ts> (ds)...)) return Null (Type); + + return obj; +} + struct code_pair_t { |