mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 15:51:37 +00:00
Bug 433073 - jsregexp.cpp should use dependent strings, r=igor
This commit is contained in:
parent
d9a4246c9e
commit
5d17330942
@ -4008,6 +4008,7 @@ js_ExecuteRegExp(JSContext *cx, JSRegExp *re, JSString *str, size_t *indexp,
|
||||
i = cp - gData.cpbegin;
|
||||
*indexp = i;
|
||||
matchlen = i - (start + gData.skipped);
|
||||
JS_ASSERT(matchlen >= 0);
|
||||
ep = cp;
|
||||
cp -= matchlen;
|
||||
|
||||
@ -4045,7 +4046,8 @@ js_ExecuteRegExp(JSContext *cx, JSRegExp *re, JSString *str, size_t *indexp,
|
||||
} \
|
||||
}
|
||||
|
||||
matchstr = js_NewStringCopyN(cx, cp, matchlen);
|
||||
matchstr = js_NewDependentString(cx, str, cp - JSSTRING_CHARS(str),
|
||||
matchlen);
|
||||
if (!matchstr) {
|
||||
cx->weakRoots.newborn[GCX_OBJECT] = NULL;
|
||||
ok = JS_FALSE;
|
||||
@ -4105,8 +4107,10 @@ js_ExecuteRegExp(JSContext *cx, JSRegExp *re, JSString *str, size_t *indexp,
|
||||
JSVAL_VOID, NULL, NULL,
|
||||
JSPROP_ENUMERATE, NULL);
|
||||
} else {
|
||||
parstr = js_NewStringCopyN(cx, gData.cpbegin + parsub->index,
|
||||
parsub->length);
|
||||
parstr = js_NewDependentString(cx, str,
|
||||
gData.cpbegin + parsub->index -
|
||||
JSSTRING_CHARS(str),
|
||||
parsub->length);
|
||||
if (!parstr) {
|
||||
cx->weakRoots.newborn[GCX_OBJECT] = NULL;
|
||||
cx->weakRoots.newborn[GCX_STRING] = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user