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.


git-svn-id: svn://10.0.0.236/trunk@192597 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
igor%mir2.org 2006-03-18 23:29:15 +00:00
parent 0c3cc0cc0c
commit 04a42e5aaa

View File

@ -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;