提交 27db8594 编写于 作者: B Behdad Esfahbod

[kern/kerx] Adjust bounds check

上级 c66f7f8c
......@@ -112,11 +112,9 @@ struct KerxSubTableFormat2
unsigned int l = *(this+leftClassTable).get_value (left, num_glyphs);
unsigned int r = *(this+rightClassTable).get_value (right, num_glyphs);
unsigned int offset = l + r;
const FWORD *arr = &(this+array);
if (unlikely ((const void *) arr < (const void *) this || (const void *) arr >= (const void *) end))
return 0;
const FWORD *v = &StructAtOffset<FWORD> (arr, offset);
if (unlikely ((const void *) v < (const void *) arr || (const void *) (v + 1) > (const void *) end))
const FWORD *v = &StructAtOffset<FWORD> (&(this+array), offset);
if (unlikely ((const char *) v < (const char *) &array ||
(const char *) v > (const char *) end - 2))
return 0;
return *v;
}
......
......@@ -194,11 +194,9 @@ struct KernSubTableFormat2
unsigned int l = (this+leftClassTable).get_class (left);
unsigned int r = (this+rightClassTable).get_class (right);
unsigned int offset = l + r;
const FWORD *arr = &(this+array);
if (unlikely ((const void *) arr < (const void *) this || (const void *) arr >= (const void *) end))
return 0;
const FWORD *v = &StructAtOffset<FWORD> (arr, offset);
if (unlikely ((const void *) v < (const void *) arr || (const void *) (v + 1) > (const void *) end))
const FWORD *v = &StructAtOffset<FWORD> (&(this+array), offset);
if (unlikely ((const char *) v < (const char *) &array ||
(const char *) v > (const char *) end - 2))
return 0;
return *v;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册