Bug 501071 Fix crash @ PL_strcmp - nsAccUtils::GetRoleMapEntry r=davidb

This commit is contained in:
Neil Rashbrook 2009-06-30 22:29:54 +01:00
parent c8ac5d9d83
commit 8f0fbe0b03

View File

@ -655,18 +655,18 @@ nsAccUtils::GetRoleMapEntry(nsIDOMNode *aNode)
nsWhitespaceTokenizer tokenizer(roleString);
while (tokenizer.hasMoreTokens()) {
// Do a binary search through table for the next role in role list
const char *role = NS_LossyConvertUTF16toASCII(tokenizer.nextToken()).get();
PRInt32 low = 0;
PRInt32 high = nsARIAMap::gWAIRoleMapLength;
while (low <= high) {
PRInt32 index = low + ((high - low) / 2);
PRInt32 compare = PL_strcmp(role, nsARIAMap::gWAIRoleMap[index].roleString);
NS_LossyConvertUTF16toASCII role(tokenizer.nextToken());
PRUint32 low = 0;
PRUint32 high = nsARIAMap::gWAIRoleMapLength;
while (low < high) {
PRUint32 index = (low + high) / 2;
PRInt32 compare = PL_strcmp(role.get(), nsARIAMap::gWAIRoleMap[index].roleString);
if (compare == 0) {
// The role attribute maps to an entry in the role table
return &nsARIAMap::gWAIRoleMap[index];
}
if (compare < 0) {
high = index - 1;
high = index;
}
else {
low = index + 1;