summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2016-12-30 14:26:28 +0100
committerPaweł Redman <pawel.redman@gmail.com>2016-12-30 14:26:28 +0100
commit88401eb553ccc95d39c0032caf4e2ddf3dfbe81a (patch)
treef514604995f0c1a416cf5967fbcc4ec6e1736b5c /src
parent73bf7c00278f369ea55a613ad87267166c035897 (diff)
Fix a read-before-init bug in lexer.c.
One of the branches in the lexer tested ls->last without checking ls->cc first.
Diffstat (limited to 'src')
-rw-r--r--src/lexer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lexer.c b/src/lexer.c
index 5610519..540160a 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -94,7 +94,7 @@ static int read_buffer(lexer_state_t *ls)
ls->in_token = false;
ret_token = true;
}
- } else if (*ls->buf_c == '/' && ls->last == '/') {
+ } else if (*ls->buf_c == '/' && (ls->cc && ls->last == '/')) {
ls->in_comment = true;
ls->in_token = false;