From: Emden R. Gansner Date: Tue, 13 Aug 2013 00:41:02 +0000 (-0400) Subject: Catch case where pattern match reports success but with an empty string. This probably X-Git-Tag: LAST_LIBGRAPH~32^2~88 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=09a2ac6a34fdb8b2ae10756629b3dd7ce8a9b1b7;p=graphviz Catch case where pattern match reports success but with an empty string. This probably corresponds to ill-specified pattern such as '&' --- diff --git a/lib/expr/exeval.c b/lib/expr/exeval.c index 29dfaeba0..5301e58d5 100644 --- a/lib/expr/exeval.c +++ b/lib/expr/exeval.c @@ -828,6 +828,11 @@ exsub(Expr_t * ex, register Exnode_t * expr, void *env, int global) v.string = vmstrdup(ex->ve, str); return v; } + if (sub[0] == sub[1]) { + exwarn("pattern match of empty string - ill-specified pattern \"%s\"?", pat); + v.string = vmstrdup(ex->ve, str); + return v; + } sfwrite(ex->tmp, str, sub[0]); if (repl) replace(ex->tmp, str, repl, ng, sub);