Bug 698584 - Fix crash in RegExp.test in case of OOM. r=mrbkap

This commit is contained in:
Tom Schuster 2011-11-03 21:57:32 +01:00
parent 2deec91f21
commit 3ba6633987
2 changed files with 15 additions and 0 deletions

View File

@ -535,6 +535,8 @@ ExecuteRegExp(JSContext *cx, Native native, uintN argc, Value *vp)
/* Step 3. */ /* Step 3. */
JSLinearString *linearInput = input->ensureLinear(cx); JSLinearString *linearInput = input->ensureLinear(cx);
if (!linearInput)
return false;
const jschar *chars = linearInput->chars(); const jschar *chars = linearInput->chars();
size_t length = input->length(); size_t length = input->length();

View File

@ -0,0 +1,13 @@
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
const MAX = 10000;
var str = "";
for (var i = 0; i < MAX; ++i) {
/x/.test(str);
str += str + 'xxxxxxxxxxxxxx';
}
/* Don't crash */