From cb1e87f221384d4a61cc5b91d2952ff3cfd2f9b1 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Fri, 13 Mar 2015 18:34:14 +0000 Subject: [PATCH] Don't segfault if span has zero length. --- re2c/cases.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/re2c/cases.cc b/re2c/cases.cc index 4cb50dfb..294f1ace 100644 --- a/re2c/cases.cc +++ b/re2c/cases.cc @@ -3,7 +3,7 @@ namespace re2c { Cases::Cases (const Span * span, uint span_size) - : def (span[span_size - 1].to) + : def (span_size == 0 ? NULL : span[span_size - 1].to) , cases (new Case[span_size]) , cases_size (0) { -- 2.40.0