diff --git a/src/hb-cff-interp-common.hh b/src/hb-cff-interp-common.hh index 0b5ee3cc1..bd23e74ad 100644 --- a/src/hb-cff-interp-common.hh +++ b/src/hb-cff-interp-common.hh @@ -360,7 +360,11 @@ struct cff_stack_t ELEM& operator [] (unsigned int i) { - if (unlikely (i >= count)) set_error (); + if (unlikely (i >= count)) + { + set_error (); + return Crap (ELEM); + } return elements[i]; } @@ -426,7 +430,10 @@ struct cff_stack_t unsigned int get_count () const { return count; } bool is_empty () const { return !count; } - protected: + hb_array_t get_subarray (unsigned int start) const + { return hb_array_t (elements).sub_array (start); } + + private: bool error; unsigned int count; ELEM elements[LIMIT]; @@ -484,9 +491,6 @@ struct arg_stack_t : cff_stack_t return true; } - hb_array_t get_subarray (unsigned int start) const - { return hb_array_t (S::elements).sub_array (start); } - private: typedef cff_stack_t S; };