[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 01/25: [troff]: Throw error on invalid {f,}special reqs.
From: |
G. Branden Robinson |
Subject: |
[groff] 01/25: [troff]: Throw error on invalid {f,}special reqs. |
Date: |
Sat, 4 Nov 2023 01:02:54 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 44db6efc019a32561a5e5d0ac4912b9477824f4c
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Nov 3 10:44:51 2023 -0500
[troff]: Throw error on invalid {f,}special reqs.
* src/roff/troff/node.cpp (set_font_specific_special_fonts)
(set_special_fonts): Throw error when invoked with insufficient
arguments.
Before:
$ printf '.fspecial\n.special\n' | groff
troff:<standard input>:1: error: cannot load font at position -1 to mark
other fonts as special contingently upon it
After:
$ printf '.fspecial\n.special\n' | ./build/test-groff
troff:<standard input>:1: error: fspecial request requires at least one
font argument
troff:<standard input>:2: error: special request requires at least one font
argument
"[Mounting] position -1" is a smoking gun of wrongness.
---
ChangeLog | 6 ++++++
src/roff/troff/node.cpp | 10 ++++++++++
2 files changed, 16 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 2a526bfdb..78fc86ae7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-11-03 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/node.cpp (set_font_specific_special_fonts)
+ (set_special_fonts): Throw error when invoked with insufficient
+ arguments.
+
2023-11-02 G. Branden Robinson <g.branden.robinson@gmail.com>
* doc/groff.texi: Add numerous @anchor commands to aid
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 6db9e9d15..ff39787b2 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6312,6 +6312,11 @@ static void read_special_fonts(special_font_list **sp)
static void set_font_specific_special_fonts()
{
font_lookup_info finfo;
+ if (!has_arg()) {
+ error("fspecial request requires at least one font argument");
+ skip_line();
+ return;
+ }
if (!has_font(&finfo))
font_lookup_error(finfo, "to mark other fonts as special"
" contingently upon it"); // a mouthful :-/
@@ -6322,6 +6327,11 @@ static void set_font_specific_special_fonts()
static void set_special_fonts()
{
+ if (!has_arg()) {
+ error("special request requires at least one font argument");
+ skip_line();
+ return;
+ }
read_special_fonts(&global_special_fonts);
skip_line();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 01/25: [troff]: Throw error on invalid {f,}special reqs.,
G. Branden Robinson <=