From fd0de881f4fc004da6f36d50a91d0e62f8eb4d8c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 15 Nov 2012 10:47:14 -0800 Subject: [PATCH] Avoid C++ undefined behavior https://bugzilla.mozilla.org/show_bug.cgi?id=810823 --- 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 3067b900a..8595038d7 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -138,13 +138,13 @@ static const void *_NullPool[64 / sizeof (void *)]; /* Generic nul-content Null objects. */ template static inline const Type& Null (void) { - ASSERT_STATIC (Type::min_size <= sizeof (_NullPool)); + ASSERT_STATIC (sizeof (Type) <= sizeof (_NullPool)); return *CastP (_NullPool); } /* Specializaiton for arbitrary-content arbitrary-sized Null objects. */ #define DEFINE_NULL_DATA(Type, data) \ -static const char _Null##Type[Type::min_size + 1] = data; /* +1 is for nul-termination in data */ \ +static const char _Null##Type[sizeof (Type) + 1] = data; /* +1 is for nul-termination in data */ \ template <> \ inline const Type& Null (void) { \ return *CastP (_Null##Type); \