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

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: addressed comments, simplified code 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-100859.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 9eccc7e4fe4ed6fd0786c0bbeb62a06ffb277498..ad850f5ee780334d7cff606d6da2710005969b11 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -296,14 +296,26 @@ Handle<Value> Shell::CreateExternalArray(const Arguments& args,
ASSERT(kMaxLength == i::ExternalArray::kMaxLength);
#endif // V8_SHARED
size_t length = 0;
+ TryCatch try_catch;
if (args[0]->IsUint32()) {
length = args[0]->Uint32Value();
} else {
Local<Number> number = args[0]->ToNumber();
- if (number.IsEmpty() || !number->IsNumber()) {
- return ThrowException(String::New("Array length must be a number."));
+ if (number.IsEmpty()) {
+ ASSERT(try_catch.HasCaught());
+ return try_catch.Exception();
+ }
+ ASSERT(number->IsNumber());
+ Local<Int32> int32 = number->ToInt32();
+ if (int32.IsEmpty()) {
+ if (try_catch.HasCaught()) {
+ return try_catch.Exception();
+ }
+ }
+ int32_t raw_length = int32->Int32Value();
+ if (try_catch.HasCaught()) {
+ return try_catch.Exception();
}
- int32_t raw_length = number->ToInt32()->Int32Value();
if (raw_length < 0) {
return ThrowException(String::New("Array length must not be negative."));
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-100859.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698