[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #64205] [mm] `INITI` validates arguments poorly
From: |
G. Branden Robinson |
Subject: |
[bug #64205] [mm] `INITI` validates arguments poorly |
Date: |
Mon, 10 Jul 2023 04:51:09 -0400 (EDT) |
Update of bug #64205 (project groff):
Status: Ready for Merge => Fixed
Open/Closed: Open => Closed
Planned Release: None => 1.24.0
_______________________________________________________
Follow-up Comment #3:
commit 504d18bae32c8dc7ef7e12dcd7e4362edc80d14e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date: Thu May 18 03:38:54 2023 -0500
[mm]: Fix Savannah #64205.
[mm]: Improve input validation of `INITI`, `IND` macros.
* contrib/mm/m.tmac (INITI): Validate the index type (first argument)
here instead of only later when `IND` is called. Actually verify that
the second argument is present and usable.
(IND): Verify that we're given arguments.
Fixes <https://savannah.gnu.org/bugs/?64205>.
Also make some design observations in comments.
Tested as follows using groff 1.22.4 and Git HEAD (on my branch).
$ cat EXPERIMENTS/test-index.sh
\#!/bin/sh
groff=./build/test-groff
groff=groff
printf '.INITI\n' | $groff -mm
printf '.INITI "" ""\n' | $groff -mm
printf '.INITI A ""\n' | $groff -mm
printf '.INITI N ""\n' | $groff -mm
printf '.INITI N myindex\n.INITI N myotherindex\n' | $groff -mm
printf '.IND foo\n' | $groff -mm
printf '.INITI N myindex\n.IND\n' | $groff -mm
printf '.INITI N myindex\n.IND ""\n' | $groff -mm
printf '.INITI N myindex\n.IND foo\n' | $groff -mm
$ sh EXPERIMENTS/test-index.sh
******************
ERROR:(<standard input>) input line 1:INITI:type missing
******************
"Input aborted, syntax error"
******************
ERROR:(<standard input>) input line 2:INITI:file already set
******************
"Input aborted, syntax error"
******************
ERROR:(<standard input>) input line 1:IND: No active INITI
******************
"Input aborted, syntax error"
Removing the second assignment to the "groff" shell variable...
$ sh EXPERIMENTS/test-index.sh
m.tmac:<standard input>:1: error: INITI: expected 2 or 3 arguments, got 0
m.tmac:<standard input>:1: error: INITI: invalid index type ''
m.tmac:<standard input>:1: error: INITI: invalid index type 'A'
m.tmac:<standard input>:1: error: INITI: index file name not specified
m.tmac:<standard input>:2: error: INITI: index file name already set
m.tmac:<standard input>:1: error: IND: no active index; call INITI first
m.tmac:<standard input>:2: error: IND: expected at least 1 argument, got
0
m.tmac:<standard input>:2: error: IND: cannot record empty index entry
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?64205>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #64205] [mm] `INITI` validates arguments poorly,
G. Branden Robinson <=