зеркало из https://github.com/mozilla/pjs.git
#119377 NS crashes if use universal Charset detector on in frame
Added some range verification when calculating order. r=nhotta, sr=brendan
This commit is contained in:
Родитель
0cb16d30d7
Коммит
7784e799ce
|
@ -206,8 +206,7 @@ PRInt32 SJISContextAnalysis::GetOrder(const char* str, PRUint32 *charLen)
|
|||
(unsigned char)*(str+1) >= (unsigned char)0x9f &&
|
||||
(unsigned char)*(str+1) <= (unsigned char)0xf1)
|
||||
return (unsigned char)*(str+1) - (unsigned char)0x9f;
|
||||
else
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRInt32 EUCJPContextAnalysis::GetOrder(const char* str, PRUint32 *charLen)
|
||||
|
@ -223,10 +222,11 @@ PRInt32 EUCJPContextAnalysis::GetOrder(const char* str, PRUint32 *charLen)
|
|||
*charLen = 1;
|
||||
|
||||
//return its order if it is hiragana
|
||||
if ((unsigned char)*str == (unsigned char)0xa4)
|
||||
return (unsigned char)*(str+1) - (unsigned char)0xa1;
|
||||
else
|
||||
return -1;
|
||||
if ((unsigned char)*str == (unsigned char)0xa4 &&
|
||||
(unsigned char)*(str+1) >= (unsigned char)0xa1 &&
|
||||
(unsigned char)*(str+1) <= (unsigned char)0xf3)
|
||||
return (unsigned char)*(str+1) - (unsigned char)0xa1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -115,8 +115,7 @@ protected:
|
|||
(unsigned char)*(str+1) >= (unsigned char)0x9f &&
|
||||
(unsigned char)*(str+1) <= (unsigned char)0xf1)
|
||||
return (unsigned char)*(str+1) - (unsigned char)0x9f;
|
||||
else
|
||||
return -1;
|
||||
return -1;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -126,7 +125,13 @@ protected:
|
|||
PRInt32 GetOrder(const char* str, PRUint32 *charLen);
|
||||
PRInt32 GetOrder(const char* str)
|
||||
//We only interested in Hiragana, so first byte is '\244'
|
||||
{return *str == '\244' ? ((unsigned char)*(str+1) - (unsigned char)0xa1):-1;};
|
||||
{
|
||||
if (*str == '\244' &&
|
||||
(unsigned char)*(str+1) >= (unsigned char)0xa1 &&
|
||||
(unsigned char)*(str+1) <= (unsigned char)0xf3)
|
||||
return (unsigned char)*(str+1) - (unsigned char)0xa1;
|
||||
return -1;
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* __JPCNTX_H__ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче