[kern] Fix access violation in Format3

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11245
This commit is contained in:
Behdad Esfahbod 2018-11-03 14:58:54 -04:00
parent 5570c87f21
commit 0589787ff5

View File

@ -417,7 +417,11 @@ struct KernSubTableFormat3
hb_array_t<const HBUINT8> rightClass = StructAfter<const UnsizedArrayOf<HBUINT8> > (leftClass).as_array (glyphCount);
hb_array_t<const HBUINT8> kernIndex = StructAfter<const UnsizedArrayOf<HBUINT8> > (rightClass).as_array (leftClassCount * rightClassCount);
unsigned int i = leftClass[left] * rightClassCount + rightClass[right];
unsigned int leftC = leftClass[left];
unsigned int rightC = rightClass[right];
if (unlikely (leftC >= leftClassCount || rightC >= rightClassCount))
return 0;
unsigned int i = leftC * rightClassCount + rightC;
return kernValue[kernIndex[i]];
}