aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorngld <ngld@tproxy.de>2013-09-18 13:59:31 +0200
committerAlon Zakai <alonzakai@gmail.com>2013-09-18 16:39:50 -0500
commit59dc10c4d7e8e240ca8c982ca156015b0ea724fa (patch)
tree3f38c17567db06ddbfb8dfe162d5217cff35dd3b
parent4c209071031528d8f6c60198f0d7395f9ef22be9 (diff)
Fix #1632: Correctly handle the optional 0x prefix for hex numbers (%x/%X).
-rw-r--r--src/library.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js
index a2ef41a0..5c2c858d 100644
--- a/src/library.js
+++ b/src/library.js
@@ -1831,6 +1831,17 @@ LibraryManager.library = {
} else {
next = get();
var first = true;
+
+ // Strip the optional 0x prefix for %x.
+ if ((type == 'x' || type == 'X') && (next == {{{ charCode('0') }}})) {
+ var peek = get();
+ if (peek == {{{ charCode('x') }}} || peek == {{{ charCode('X') }}}) {
+ next = get();
+ } else {
+ unget();
+ }
+ }
+
while ((curr < max_ || isNaN(max_)) && next > 0) {
if (!(next in __scanString.whiteSpace) && // stop on whitespace
(type == 's' ||