summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 79ed87d..3733f49 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1352,19 +1352,38 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
goto imaginary;
#endif
if (c == 'x' || c == 'X') {
+
/* Hex */
+ c = tok_nextc(tok);
+ if (!isxdigit(c)) {
+ tok->done = E_TOKEN;
+ tok_backup(tok, c);
+ return ERRORTOKEN;
+ }
do {
c = tok_nextc(tok);
} while (isxdigit(c));
}
else if (c == 'o' || c == 'O') {
/* Octal */
+ c = tok_nextc(tok);
+ if (c < '0' || c > '8') {
+ tok->done = E_TOKEN;
+ tok_backup(tok, c);
+ return ERRORTOKEN;
+ }
do {
c = tok_nextc(tok);
} while ('0' <= c && c < '8');
}
else if (c == 'b' || c == 'B') {
/* Binary */
+ c = tok_nextc(tok);
+ if (c != '0' && c != '1') {
+ tok->done = E_TOKEN;
+ tok_backup(tok, c);
+ return ERRORTOKEN;
+ }
do {
c = tok_nextc(tok);
} while (c == '0' || c == '1');