Index: src/json-parser.h |
diff --git a/src/json-parser.h b/src/json-parser.h |
index 3161a01a79cd86ae62a88051090dce6556c15fab..9ccc8ed1fb320c087b0fbaddf01d2b9bc9fddb2b 100644 |
--- a/src/json-parser.h |
+++ b/src/json-parser.h |
@@ -400,12 +400,14 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonNumber() { |
if ('0' <= c0_ && c0_ <= '9') return ReportUnexpectedCharacter(); |
} else { |
int i = 0; |
+ int digits = 0; |
if (c0_ < '1' || c0_ > '9') return ReportUnexpectedCharacter(); |
do { |
i = i * 10 + c0_ - '0'; |
+ digits++; |
Advance(); |
- } while (c0_ >= '0' && c0_ <= '9' && i <= (kMaxInt - 9) / 10); |
- if (c0_ != '.' && c0_ != 'e' && c0_ != 'E') { |
+ } while (c0_ >= '0' && c0_ <= '9'); |
+ if (c0_ != '.' && c0_ != 'e' && c0_ != 'E' && digits < 10) { |
SkipWhitespace(); |
return Handle<Smi>(Smi::FromInt((negative ? -i : i)), isolate()); |
} |