From 1b6568b322ea4817ae7e0afe71b95718333c6afa Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 13 Nov 2011 09:46:08 -0800 Subject: Bug #34813 * match.c (v_freeform): Fail if the data is null, to avoid a false positive match as an empty line, followed by the type error of incrementing a nonexistent data line number. --- ChangeLog | 8 ++++++++ match.c | 3 +++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 044c2b88..989226e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-11-13 Kaz Kylheku + + Bug #34813 + + * match.c (v_freeform): Fail if the data is null, + to avoid a false positive match as an empty line, followed by the type + error of incrementing a nonexistent data line number. + 2011-11-12 Kaz Kylheku * parser.y: Correctly record line number info for regex. diff --git a/match.c b/match.c index ad260cdc..38fdfc32 100644 --- a/match.c +++ b/match.c @@ -1670,6 +1670,9 @@ static val v_freeform(match_files_ctx *c) if ((c->spec = rest(c->spec)) == nil) { sem_error(first_spec, lit("freeform must be followed by a query line"), nao); + } else if (!c->data) { + debuglf(specline, lit("freeform match failure: no data"), nao); + return nil; } else { val limit = or2(if2(nump(first(vals)), first(vals)), if2(nump(second(vals)), second(vals))); -- cgit v1.2.3