aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-10-28 20:39:34 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2018-10-28 20:39:34 +0300
commit661f723d39e03ca6eb05d7376a43ca33db478354 (patch)
treed7c2e9eba19ac11397f6b72f5dc06d4557c9a9b1
parentfe2e1d469ac163a076e5cbc760cc3f4f051ee615 (diff)
downloadnasm-661f723d39e03ca6eb05d7376a43ca33db478354.tar.gz
nasm-661f723d39e03ca6eb05d7376a43ca33db478354.tar.xz
nasm-661f723d39e03ca6eb05d7376a43ca33db478354.zip
preproc: Fix out of bound access on malformed input
A fuzzer revealed a problem in preproc code. https://bugzilla.nasm.us/show_bug.cgi?id=3392521 Reported-by: ganshuitao <ganshuitao@gmail.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--asm/preproc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/asm/preproc.c b/asm/preproc.c
index 0174c9ab..9034135c 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -4002,7 +4002,7 @@ static Token *expand_mmac_params(Token * tline)
thead = NULL;
while (tline) {
- if (tline->type == TOK_PREPROC_ID &&
+ if (tline->type == TOK_PREPROC_ID && tline->text && tline->text[0] &&
(((tline->text[1] == '+' || tline->text[1] == '-') && tline->text[2]) ||
(tline->text[1] >= '0' && tline->text[1] <= '9') ||
tline->text[1] == '%')) {