diff options
| author | Fedor Indutny <fedor@indutny.com> | 2014-08-11 17:38:09 +0400 |
|---|---|---|
| committer | Fedor Indutny <fedor@indutny.com> | 2014-08-11 17:38:09 +0400 |
| commit | 396b9deacdf03ff351ea238f4def59e6de2a1305 (patch) | |
| tree | 722da56f639e00507582cdd60be6991b757a52ee | |
| parent | 8fd350e3575c8dbaab50ac992e7ba6c5b300fabd (diff) | |
| download | node-v0.8.tar.gz | |
deps: throw StackOverflow in JSON.parsev0.8
Backport of:
fc6343a79274b6a1e99037ebb131096e2da05306
from v8 upstream.
Original commit message:
Catch stack overflow in JSON.parse.
BUG=
Review URL: https://chromiumcodereview.appspot.com/11275039
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@12816 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
Reviewed-By: Fedor Indutny <fedor@indutny.com>
| -rw-r--r-- | deps/v8/src/json-parser.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/deps/v8/src/json-parser.h b/deps/v8/src/json-parser.h index 7265165ac..c51e1416d 100644 --- a/deps/v8/src/json-parser.h +++ b/deps/v8/src/json-parser.h @@ -185,8 +185,10 @@ Handle<Object> JsonParser<seq_ascii>::ParseJson(Handle<String> source, AdvanceSkipWhitespace(); Handle<Object> result = ParseJsonValue(); if (result.is_null() || c0_ != kEndOfString) { - // Parse failed. Current character is the unexpected token. + // Some exception (for example stack overflow) is already pending. + if (isolate_->has_pending_exception()) return Handle<Object>::null(); + // Parse failed. Current character is the unexpected token. const char* message; Factory* factory = isolate()->factory(); Handle<JSArray> array; @@ -237,6 +239,12 @@ Handle<Object> JsonParser<seq_ascii>::ParseJson(Handle<String> source, // Parse any JSON value. template <bool seq_ascii> Handle<Object> JsonParser<seq_ascii>::ParseJsonValue() { + StackLimitCheck stack_check(isolate_); + if (stack_check.HasOverflowed()) { + isolate_->StackOverflow(); + return Handle<Object>::null(); + } + switch (c0_) { case '"': return ParseJsonString(); |
