From e2b59201d5049a8ad509b280e729a871756abc99 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 11 Jun 2019 15:48:26 +0200 Subject: [PATCH] Issue 105: Fix NULL dereferencing in regexp compiler. "x(?:)" parses to Cat(Char(x), Empty), but the compiler couldn't handle an empty right hand side of the Cat node. --- regexp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regexp.c b/regexp.c index 3f800e3..01e1aa0 100644 --- a/regexp.c +++ b/regexp.c @@ -637,10 +637,10 @@ static void compile(Reprog *prog, Renode *node) Reinst *inst, *split, *jump; int i; +loop: if (!node) return; -loop: switch (node->type) { case P_CAT: compile(prog, node->x);