Subject: bug#26690: [bug-diffutils] bug#26690: Acknowledgement (Crash with --ignore-matching-lines)

From: Paul Eggert <[email-masked]>
Date: Thu, 27 Apr 2017 22:43:05 -0700

Marcel Böhme wrote:
> Suggested patch:

Thanks, but I'm not seeing the point of continuing after an invalid regular 
expression is found. I installed the attached simpler patch for now.
From 4917e6aa503765eaac01314f23e2401b799ed342 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Thu, 27 Apr 2017 22:39:07 -0700
Subject: [PATCH] diff: don't crash if regexp is invalid
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Marcel Böhme in:
http://lists.gnu.org/archive/html/bug-diffutils/2017-04/msg00002.html
* src/diff.c (add_regexp): Exit if re_compile_pattern fails.
---
 src/diff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/diff.c b/src/diff.c
index 76851ac..48b6235 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -818,7 +818,7 @@ add_regexp (struct regexp_list *reglist, char const *pattern)
   char const *m = re_compile_pattern (pattern, patlen, reglist->buf);
 
   if (m != 0)
-    error (0, 0, "%s: %s", pattern, m);
+    error (EXIT_TROUBLE, 0, "%s: %s", pattern, m);
   else
     {
       char *regexps = reglist->regexps;
-- 
2.9.3