[colr] Limit recursion depth

This commit is contained in:
Behdad Esfahbod 2022-12-17 08:59:33 -07:00
parent 378bbeea01
commit 1953d26a8a
1 changed files with 5 additions and 1 deletions

View File

@ -70,6 +70,7 @@ public:
hb_paint_funcs_t *funcs;
void *data;
VarStoreInstancer &instancer;
int depth_left = HB_COLRV1_MAX_NESTING_LEVEL;
hb_paint_context_t (const void *base_,
hb_paint_funcs_t *funcs_,
@ -2033,7 +2034,10 @@ struct COLR_accelerator_t : COLR::accelerator_t {
void
hb_paint_context_t::recurse (const Paint &paint)
{
paint.dispatch (this);
depth_left--;
if (depth_left > 0)
paint.dispatch (this);
depth_left++;
}
} /* namespace OT */