提交 e940530c 编写于 作者: B Behdad Esfahbod
上级 1d995a34
...@@ -386,6 +386,8 @@ struct StateTable ...@@ -386,6 +386,8 @@ struct StateTable
const HBUINT16 *states = (this+stateArrayTable).arrayZ; const HBUINT16 *states = (this+stateArrayTable).arrayZ;
const Entry<Extra> *entries = (this+entryTable).arrayZ; const Entry<Extra> *entries = (this+entryTable).arrayZ;
unsigned int num_classes = nClasses;
unsigned int num_states = 1; unsigned int num_states = 1;
unsigned int num_entries = 0; unsigned int num_entries = 0;
...@@ -393,13 +395,16 @@ struct StateTable ...@@ -393,13 +395,16 @@ struct StateTable
unsigned int entry = 0; unsigned int entry = 0;
while (state < num_states) while (state < num_states)
{ {
if (unlikely (hb_unsigned_mul_overflows (num_classes, states[0].static_size)))
return_trace (false);
if (unlikely (!c->check_array (states, if (unlikely (!c->check_array (states,
num_states, num_states,
states[0].static_size * nClasses))) num_classes * states[0].static_size)))
return_trace (false); return_trace (false);
{ /* Sweep new states. */ { /* Sweep new states. */
const HBUINT16 *stop = &states[num_states * nClasses]; const HBUINT16 *stop = &states[num_states * num_classes];
for (const HBUINT16 *p = &states[state * nClasses]; p < stop; p++) for (const HBUINT16 *p = &states[state * num_classes]; p < stop; p++)
num_entries = MAX<unsigned int> (num_entries, *p + 1); num_entries = MAX<unsigned int> (num_entries, *p + 1);
state = num_states; state = num_states;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册