зеркало из https://github.com/mozilla/pjs.git
Bug 330951: Asserting that string arguments str1 and str2 arguments are not NULLs in js_CompareStrings and js_EqualStrings.
Previously passing str1 and str2 set to NULL did not crash as str1 and str2 compared equals as pointers and the functions returned true without accessing *str1 or *str2. In turn it allowed for the regression from bug 311515 causing this bug to survive much longer then it should. r=brendan.
This commit is contained in:
Родитель
587aa1bd71
Коммит
3efeeb5c5b
|
@ -2825,6 +2825,9 @@ js_CompareStrings(JSString *str1, JSString *str2)
|
|||
const jschar *s1, *s2;
|
||||
intN cmp;
|
||||
|
||||
JS_ASSERT(str1);
|
||||
JS_ASSERT(str2);
|
||||
|
||||
/* Fast case: pointer equality could be a quick win. */
|
||||
if (str1 == str2)
|
||||
return 0;
|
||||
|
@ -2846,6 +2849,9 @@ js_EqualStrings(JSString *str1, JSString *str2)
|
|||
size_t n;
|
||||
const jschar *s1, *s2;
|
||||
|
||||
JS_ASSERT(str1);
|
||||
JS_ASSERT(str2);
|
||||
|
||||
/* Fast case: pointer equality could be a quick win. */
|
||||
if (str1 == str2)
|
||||
return JS_TRUE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче