[kern/kerx] Adjust bounds check
This commit is contained in:
parent
c66f7f8c5d
commit
27db859416
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue