From 9843f07658ae6b9b7b586f9c69cdb2c99b24ad18 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 15 Jul 2022 16:03:55 -0600 Subject: [PATCH] [OffsetTo] Try catching nullable offsets to unbounded types Doesn't catch all cases; if type is not fully defined at OffsetTo time, we can't know. Fixes https://github.com/harfbuzz/harfbuzz/issues/1300 to the best we can do. --- src/hb-open-type.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 2c1c49b15..8e57a683e 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -304,6 +304,10 @@ struct _hb_has_null template struct OffsetTo : Offset { + // Make sure Type is not unbounded; works only for types that are fully defined at OffsetTo time. + static_assert (has_null == false || + (hb_has_null_size (Type) || !hb_has_min_size (Type)), ""); + HB_DELETE_COPY_ASSIGN (OffsetTo); OffsetTo () = default;