Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: test/cctest/test-strings.cc

Issue 9969196: Make SubStringStub more robust wrt unsafe arguments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698