Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 | 2 |
| 3 // Check that we can traverse very deep stacks of ConsStrings using | 3 // Check that we can traverse very deep stacks of ConsStrings using |
| 4 // StringInputBuffer. Check that Get(int) works on very deep stacks | 4 // StringInputBuffer. Check that Get(int) works on very deep stacks |
| 5 // of ConsStrings. These operations may not be very fast, but they | 5 // of ConsStrings. These operations may not be very fast, but they |
| 6 // should be possible without getting errors due to too deep recursion. | 6 // should be possible without getting errors due to too deep recursion. |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include "v8.h" | 10 #include "v8.h" |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 LocalContext context; | 613 LocalContext context; |
| 614 v8::V8::IgnoreOutOfMemoryException(); | 614 v8::V8::IgnoreOutOfMemoryException(); |
| 615 v8::Local<v8::Script> script = | 615 v8::Local<v8::Script> script = |
| 616 v8::Script::Compile(v8::String::New(join_causing_out_of_memory)); | 616 v8::Script::Compile(v8::String::New(join_causing_out_of_memory)); |
| 617 v8::Local<v8::Value> result = script->Run(); | 617 v8::Local<v8::Value> result = script->Run(); |
| 618 | 618 |
| 619 // Check for out of memory state. | 619 // Check for out of memory state. |
| 620 CHECK(result.IsEmpty()); | 620 CHECK(result.IsEmpty()); |
| 621 CHECK(context->HasOutOfMemoryException()); | 621 CHECK(context->HasOutOfMemoryException()); |
| 622 } | 622 } |
| 623 | |
| 624 | |
| 625 TEST(RobustSubStringStub) { | |
| 626 // This tests whether the SubStringStub can handle unsafe arguments. | |
| 627 // If not recognized, those unsafe arguments lead to out-of-bounds reads. | |
| 628 FLAG_allow_natives_syntax = true; | |
| 629 InitializeVM(); | |
| 630 HandleScope scope; | |
| 631 v8::Local<v8::Value> result; | |
| 632 Handle<String> string; | |
| 633 CompileRun("%_SubString('abcdef', 0, 10000)"); | |
| 634 CompileRun("%_SubString('abcdef', 5, 2)"); | |
|
Erik Corry
2012/04/17 09:06:58
I'd like more tests here. Negative numbers, borde
| |
| 635 } | |
| OLD | NEW |