[cff] Tighten up arg-stack access
This commit is contained in:
parent
8c616a6efe
commit
6106ef8c0f
|
@ -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<const ELEM> get_subarray (unsigned int start) const
|
||||
{ return hb_array_t<const ELEM> (elements).sub_array (start); }
|
||||
|
||||
private:
|
||||
bool error;
|
||||
unsigned int count;
|
||||
ELEM elements[LIMIT];
|
||||
|
@ -484,9 +491,6 @@ struct arg_stack_t : cff_stack_t<ARG, 513>
|
|||
return true;
|
||||
}
|
||||
|
||||
hb_array_t<const ARG> get_subarray (unsigned int start) const
|
||||
{ return hb_array_t<const ARG> (S::elements).sub_array (start); }
|
||||
|
||||
private:
|
||||
typedef cff_stack_t<ARG, 513> S;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue