From b5f45d6597717c1d440b801122b4a02ffbbdf4da Mon Sep 17 00:00:00 2001 From: Mykola Bilochub Date: Sat, 3 Jun 2017 02:39:16 +0300 Subject: [PATCH] parser: disallow empty hex, octal, binary literals Refs: https://github.com/metarhia/jstp/issues/175 PR-URL: https://github.com/metarhia/jstp/pull/207 Reviewed-By: Denys Otrishko Reviewed-By: Alexey Orlenko --- src/jsrs_parser.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/jsrs_parser.cc b/src/jsrs_parser.cc index 5dc93b3..7273099 100644 --- a/src/jsrs_parser.cc +++ b/src/jsrs_parser.cc @@ -334,6 +334,10 @@ MaybeLocal ParseNumber(Isolate* isolate, } else { result = ParseIntegerNumber(isolate, number_start, end, size, base, negate_result); + if (*size == 0) { + THROW_EXCEPTION(SyntaxError, "Empty number value"); + return MaybeLocal(); + } } *size += number_start - begin; return result;