gnuplot crashes if GNUPLOT_DRIVER_DIR is invalid

Dima Kogan <[email protected]> Sun, 11 Jun 2023 20:03:02 -0700
Newsgroups gmane.comp.graphics.gnuplot.devel
Message-ID <[email protected]>
Reproducible like this:

  GNUPLOT_DRIVER_DIR='' ./gnuplot

It should report an error message, but not crash.

Fixed in the attached patch

_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
no-crash-if-no-input-line.patch (text/x-diff, 434 B)
diff --git a/src/util.c b/src/util.c
index a1ad8689c..25f57b837 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1041,7 +1041,7 @@ print_line_with_error(int t_num)
 	/* Print problem line from data file to the terminal */
 	df_showdata();
 
-    } else {
+    } else if(gp_input_line != NULL){
 
 	/* If the current line was built by concatenation of lines inside */
 	/* a {bracketed clause}, try to reconstruct the true line number  */