[Pkg-javascript-commits] [node-acorn-jsx] 10/484: Fix bug in number parser

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:19:56 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit 092a524f4304428b4d333459715e9678c95cfe34
Author: Marijn Haverbeke <marijnh at gmail.com>
Date:   Mon Sep 24 21:34:42 2012 +0200

    Fix bug in number parser
---
 acorn.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/acorn.js b/acorn.js
index 8566b49..9e7849b 100644
--- a/acorn.js
+++ b/acorn.js
@@ -960,7 +960,7 @@
 
     var str = input.slice(start, tokPos), val;
     if (isFloat) val = parseFloat(str);
-    else if (ch !== "0") val = parseInt(str, 10);
+    else if (ch !== "0" || str.length === 1) val = parseInt(str, 10);
     else if (/[89]/.test(str) || strict) raise(start, "Invalid number");
     else val = parseInt(str, 8);
     return finishToken(_num, val);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git



More information about the Pkg-javascript-commits mailing list