From ff52f47537c9bf5c6acc636f25ae5f7f70d20f3b Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 15 Oct 2010 14:06:30 -0700 Subject: Fix unicode parsing Close #56 --- src/Parser.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/Parser.js b/src/Parser.js index 2c681be0..9082bb2a 100644 --- a/src/Parser.js +++ b/src/Parser.js @@ -170,6 +170,10 @@ function lex(text, parseStrings){ if (escape) { if (ch == 'u') { var hex = text.substring(index + 1, index + 5); + if (!hex.match(/[\da-f]{4}/i)) + throw "Lexer Error: Invalid unicode escape [\\u" + + hex + "] starting at column '" + + start + "' in expression '" + text + "'."; index += 4; string += String.fromCharCode(parseInt(hex, 16)); } else { -- cgit v1.2.3