bug 593296 - avoid potential read beyond end of kern-pair list. r=jfkthame a=blocking-beta7+

This commit is contained in:
John Daggett 2010-09-22 10:15:57 +01:00
parent 4fbb745b8c
commit a4541c4944

View File

@ -284,6 +284,7 @@ GetKernValueFmt0(const void* aSubtable,
const KernPair *lo = reinterpret_cast<const KernPair*>(hdr + 1);
const KernPair *hi = lo + PRUint16(hdr->nPairs);
const KernPair *limit = hi;
if (reinterpret_cast<const char*>(aSubtable) + aSubtableLen <
reinterpret_cast<const char*>(hi)) {
@ -304,7 +305,7 @@ GetKernValueFmt0(const void* aSubtable,
}
}
if (KERN_PAIR_KEY(lo->left, lo->right) == key) {
if (lo < limit && KERN_PAIR_KEY(lo->left, lo->right) == key) {
if (aIsOverride) {
aValue = PRInt16(lo->value);
} else if (aIsMinimum) {