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

Unified Diff: src/d8.cc

Issue 8898021: Fix crash in d8 when external array ctor hits stack overflow (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 9eccc7e4fe4ed6fd0786c0bbeb62a06ffb277498..cc91daa692f1cd00e17af640468915f45eeb74a5 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -301,10 +301,26 @@ Handle<Value> Shell::CreateExternalArray(const Arguments& args,
} else {
Local<Number> number = args[0]->ToNumber();
if (number.IsEmpty() || !number->IsNumber()) {
+ i::Isolate* isolate = i::Isolate::Current();
+ if (isolate->try_catch_handler()->HasCaught()) {
+ return isolate->try_catch_handler()->Exception();
+ }
return ThrowException(String::New("Array length must be a number."));
}
- int32_t raw_length = number->ToInt32()->Int32Value();
+ Local<Int32> int32 = number->ToInt32();
+ if (int32.IsEmpty()) {
+ i::Isolate* isolate = i::Isolate::Current();
+ if (isolate->try_catch_handler()->HasCaught()) {
+ return isolate->try_catch_handler()->Exception();
+ }
+ return ThrowException(String::New("Array length must be a number."));
Rico 2011/12/13 11:28:39 we already established that length is a number, so
Jakob Kummerow 2011/12/13 13:04:37 On second thought, no, we can't. Done.
+ }
+ int32_t raw_length = int32->Int32Value();
if (raw_length < 0) {
+ i::Isolate* isolate = i::Isolate::Current();
+ if (isolate->try_catch_handler()->HasCaught()) {
+ return isolate->try_catch_handler()->Exception();
+ }
return ThrowException(String::New("Array length must not be negative."));
}
if (raw_length > static_cast<int32_t>(kMaxLength)) {
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-100859.js » ('j') | test/mjsunit/regress/regress-crbug-100859.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698