From 60db142784bb145426e4a02635bbad4f2f260d16 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Jul 2023 20:49:32 -0600 Subject: [PATCH] [layout] Remove unused "max-size" cruft --- src/OT/Layout/GPOS/PairValueRecord.hh | 1 - src/OT/Layout/GSUB/Ligature.hh | 1 - src/hb-machinery.hh | 5 ----- src/hb-null.hh | 9 -------- src/hb-open-type.hh | 30 --------------------------- src/hb-ot-layout-gsubgpos.hh | 2 -- 6 files changed, 48 deletions(-) diff --git a/src/OT/Layout/GPOS/PairValueRecord.hh b/src/OT/Layout/GPOS/PairValueRecord.hh index c99a38699..72bf0e99b 100644 --- a/src/OT/Layout/GPOS/PairValueRecord.hh +++ b/src/OT/Layout/GPOS/PairValueRecord.hh @@ -23,7 +23,6 @@ struct PairValueRecord * followed by for second glyph */ public: DEFINE_SIZE_ARRAY (Types::HBGlyphID::static_size, values); - DEFINE_SIZE_MAX (Types::HBGlyphID::static_size + 2 * Value::static_size * 8 * sizeof (ValueFormat)); int cmp (hb_codepoint_t k) const { return secondGlyph.cmp (k); } diff --git a/src/OT/Layout/GSUB/Ligature.hh b/src/OT/Layout/GSUB/Ligature.hh index db3fc55f7..402ed12ae 100644 --- a/src/OT/Layout/GSUB/Ligature.hh +++ b/src/OT/Layout/GSUB/Ligature.hh @@ -19,7 +19,6 @@ struct Ligature * in writing direction */ public: DEFINE_SIZE_ARRAY (Types::size + 2, component); - DEFINE_SIZE_MAX (65536 * Types::HBGlyphID::static_size); bool sanitize (hb_sanitize_context_t *c) const { diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 70aed5426..ecff94f1b 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -104,7 +104,6 @@ static inline Type& StructAfter(TObject &X) unsigned int get_size () const { return (size); } \ static constexpr unsigned null_size = (size); \ static constexpr unsigned min_size = (size); \ - static constexpr unsigned max_size = (size); \ static constexpr unsigned static_size = (size) #define DEFINE_SIZE_UNION(size, _member) \ @@ -132,10 +131,6 @@ static inline Type& StructAfter(TObject &X) unsigned int get_size () const { return (size - (array).min_size + (array).get_size ()); } \ DEFINE_SIZE_ARRAY(size, array) -#define DEFINE_SIZE_MAX(size) \ - DEFINE_INSTANCE_ASSERTION (sizeof (*this) <= (size)) \ - static constexpr unsigned max_size = (size) - /* diff --git a/src/hb-null.hh b/src/hb-null.hh index 342f9db76..6796906ba 100644 --- a/src/hb-null.hh +++ b/src/hb-null.hh @@ -48,15 +48,6 @@ template using hb_has_min_size = _hb_has_min_size; #define hb_has_min_size(T) hb_has_min_size::value -template -struct _hb_has_max_size : hb_false_type {}; -template -struct _hb_has_max_size> - : hb_true_type {}; -template -using hb_has_max_size = _hb_has_max_size; -#define hb_has_max_size(T) hb_has_max_size::value - template struct _hb_has_null_size : hb_false_type {}; template diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 7de5a9b7a..d3fdd1caf 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -718,36 +718,6 @@ struct ArrayOf return_trace (out); } - /* Special-case ArrayOf Offset16To structs with a maximum size. - * - * Currently disabled, because this throws off max_op accounting - * and can cause timeouts in further operations. - * https://oss-fuzz.com/testcase-detail/6153196517851136 - */ - template - HB_ALWAYS_INLINE - bool sanitize (hb_sanitize_context_t *c, const Base *base) const - { - TRACE_SANITIZE (this); - - if (unlikely (!sanitize_shallow (c))) return_trace (false); - - unsigned max_len = 65536 + Type::target_t::max_size; - - if (unlikely (c->check_range_fast (base, max_len))) - return_trace (true); - - unsigned int count = len; - for (unsigned int i = 0; i < count; i++) - if (unlikely (!c->dispatch (arrayZ[i], base))) - return_trace (false); - return_trace (true); - } - template HB_ALWAYS_INLINE bool sanitize (hb_sanitize_context_t *c, Ts&&... ds) const diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 0139927b6..136e088ab 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -2087,7 +2087,6 @@ struct Rule * design order */ public: DEFINE_SIZE_ARRAY (4, inputZ); - DEFINE_SIZE_MAX (65536 * (Types::HBUINT::static_size + LookupRecord::static_size)); }; template @@ -3262,7 +3261,6 @@ struct ChainRule * design order) */ public: DEFINE_SIZE_MIN (8); - DEFINE_SIZE_MAX (65536 * (3 * Types::HBUINT::static_size + LookupRecord::static_size)); }; template