Status: New
Owner: ----
New issue 2185 by [email protected]: Array.sort throws RangeError:
Maximum call stack size exceeded
http://code.google.com/p/v8/issues/detail?id=2185
I get a crash in sorting the concatenation of two copies of a longish
sorted array of numbers: somehow Array.sort ran out of call stack. System
details and code sample below.
This was originally node.js issue #3443
(github.com/joyent/node/issues/3443).
$ uname -a; gcc --version | head -1
Linux [redacted] 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC
2012 x86_64 x86_64 x86_64 GNU/Linux
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
$ cat hello_world.cc
#include <v8.h>
using namespace v8;
int main(int argc, char *argv[]) {
HandleScope handle_scope;
Persistent<Context> context = Context::New();
Context::Scope context_scope(context);
Handle<String> source = String::New(
"c = 30000;"
"a = [];"
"for (i = 0; i < 2 * c; i += 1) {"
" a.push(i%c);"
"}"
"a.sort(function (x, y) { return x - y; });"
"a[2 * c - 2]"
);
Handle<Script> script = Script::Compile(source);
Handle<Value> result = script->Run();
context.Dispose();
String::AsciiValue ascii(result);
printf("%s\n", *ascii);
return 0;
};
$ g++ -Iinclude hello_world.cc -o hello_world
out/x64.release/obj.target/tools/gyp/libv8_{base,snapshot}.a -lpthread
&& ./hello_world
<unknown>:66: Uncaught RangeError: Maximum call stack size exceeded
Segmentation fault (core dumped)
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev