From 61f2d86d93e46309f5721b3700e1b189350282dd Mon Sep 17 00:00:00 2001
From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
Date: Fri, 3 Feb 2023 05:11:46 -0600
Subject: [tbl]: Fix Savannah #63751.

* src/preproc/tbl/main.cpp (main): Avoid reading from invalid memory
  upon failure to open an input file.

Fixes <https://savannah.gnu.org/bugs/?63751>.
---
 src/preproc/tbl/main.cpp | 4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/preproc/tbl/main.cpp b/src/preproc/tbl/main.cpp
index 467c19f..a3308ba 100644
--- a/src/preproc/tbl/main.cpp
+++ b/src/preproc/tbl/main.cpp
@@ -1658,8 +1658,10 @@ int main(int argc, char **argv)
       else {
 	errno = 0;
 	FILE *fp = fopen(argv[i], "r");
-	if (fp == 0)
+	if (fp == 0) {
+	  current_filename = 0 /* nullptr */;
 	  fatal("can't open '%1': %2", argv[i], strerror(errno));
+	}
 	else {
 	  current_lineno = 1;
 	  string fn(argv[i]);
-- 
cgit v1.1

