[cff] When max-ops is reached return false

Slight speedup too.
This commit is contained in:
Behdad Esfahbod 2023-05-23 11:57:22 -06:00
parent 2655b7607c
commit 84354d3f23

View file

@ -883,14 +883,12 @@ struct cs_interpreter_t : interpreter_t<ENV>
unsigned max_ops = HB_CFF_MAX_OPS;
for (;;) {
if (unlikely (!--max_ops))
OPSET::process_op (SUPER::env.fetch_op (), SUPER::env, param);
if (unlikely (SUPER::env.in_error () || !--max_ops))
{
SUPER::env.set_error ();
break;
}
OPSET::process_op (SUPER::env.fetch_op (), SUPER::env, param);
if (unlikely (SUPER::env.in_error ()))
return false;
}
if (SUPER::env.is_endchar ())
break;
}