From 9abeda33e7ce111a266d5e3ec4dafe65c26d5cd0 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 18 Apr 2019 20:15:15 +0300 Subject: Fix core dump upon syntax error. --- main.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index d6e34266..8327cc74 100644 --- a/main.c +++ b/main.c @@ -1262,6 +1262,9 @@ catchsig(int sig) || sig == SIGBUS #endif ) { + if (errcount > 0) // assume a syntax error corrupted our data structures + exit(EXIT_FATAL); + set_loc(__FILE__, __LINE__); msg(_("fatal error: internal error")); /* fatal won't abort() if not compiled for debugging */ @@ -1279,6 +1282,9 @@ catchsig(int sig) static int catchsegv(void *fault_address, int serious) { + if (errcount > 0) // assume a syntax error corrupted our data structures + exit(EXIT_FATAL); + set_loc(__FILE__, __LINE__); msg(_("fatal error: internal error: segfault")); fflush(NULL); -- cgit v1.2.3