https://bugs.gentoo.org/746419

This backports and consolidates the following commits from upstream git:

commit a7205eda482948a0408b0ed29cdde89593feedc7
Author: Ethan A Merritt <merritt@u.washington.edu>
Date:   Sat Sep 12 10:18:10 2020 -0700

    Better error handling for faulty font syntax

    Commit 660e2fbd failed to deal with an error detected at the final character
    of a text string.

    Bugs #2303 #2308

commit 660e2fbd681cb47acd42595f050fb2f938194b0e
Author: Ethan A Merritt <merritt@u.washington.edu>
Date:   Tue Sep 1 17:57:37 2020 -0700

    Better error handling for faulty font syntax

    A missing close-quote in an enhanced text font specification could
    cause a segfault.
    Bug #2303

--- gnuplot-5.2.8-orig/src/term.c
+++ gnuplot-5.2.8/src/term.c
@@ -2361,7 +2361,7 @@
 			    ++p;
 			if (*p != *start_of_fontname) {
 			    int_warn(NO_CARET, "cannot interpret font name %s", start_of_fontname);
-			    p = start_of_fontname;
+			    break;
 			}
 			start_of_fontname++;
 			end_of_fontname = p++;
