gbranden pushed a commit to branch master
in repository groff.
commit 88f1ad37adbc8b83cbc0ab6b0e303fc2be74aad0
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Oct 20 15:45:08 2026 -0500
[troff]: Fix Savannah #68786.
* src/roff/troff/input.cpp (pipe_source_request, pipe_output)
(system_request): Withdraw assert(3)ion in favor of real input
validation, already present.
(pipe_source_request): Pump the token stream if the argument
interpolated nothing or was otherwise invalid, to get past the pending
newline.
(close_request): Replace assert(3)ion with real input validation.
Fixes <https://savannah.gnu.org/bugs/?68786>.
---
ChangeLog | 15 +++++++++++++++
src/roff/troff/input.cpp | 17 +++++++----------
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9cab05622..e10ae577c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2026-10-17 G. Branden Robinson <[email protected]>
+
+ [troff]: Fix Savannah #68786.
+
+ * src/roff/troff/input.cpp (pipe_source_request, pipe_output)
+ (system_request): Withdraw assert(3)ion in favor of
+ real input validation, already present.
+ (pipe_source_request): Pump the token stream if the argument
+ interpolated nothing or was otherwise invalid, to get past the
+ pending newline.
+ (close_request): Replace assert(3)ion with real input
+ validation.
+
+ Fixes <https://savannah.gnu.org/bugs/?68786>.
+
2026-10-17 G. Branden Robinson <[email protected]>
[groff]: Regression-test Savannah #68786.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index ba24a7f1c..7ae4aae4e 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -7712,11 +7712,12 @@ static void pipe_source_request() // .pso
return;
}
char *pcmd = read_rest_of_line_as_argument();
- // `has_arg()` should have ensured that this pointer is non-null.
- assert(pcmd != 0 /* nullptr */);
- if (0 /* nullptr */ == pcmd)
+ if (0 /* nullptr */ == pcmd) {
error("cannot apply piped command source request to empty"
" argument");
+ tok.next();
+ return;
+ }
errno = 0;
FILE *fp = popen(pcmd, POPEN_RT);
if (fp != 0 /* nullptr */)
@@ -8617,9 +8618,9 @@ static void close_request() // .close
return;
}
symbol stream = read_identifier();
- // Testing has_arg() should have ensured this.
- assert(stream != 0 /* nullptr */);
- if (!stream.is_null())
+ if (stream.is_null())
+ error("cannot apply close request to empty argument");
+ else
close_stream(stream);
skip_line();
}
@@ -9650,8 +9651,6 @@ static void pipe_output() // .pi
return;
}
char *pc = read_rest_of_line_as_argument();
- // `has_arg()` should have ensured that this pointer is non-null.
- assert(pc != 0 /* nullptr */);
if (0 /* nullptr */ == pc)
error("cannot apply pipe request to empty command");
// Are we adding to an existing pipeline?
@@ -9692,8 +9691,6 @@ static void system_request() // .sy
return;
}
char *command = read_rest_of_line_as_argument();
- // `has_arg()` should have ensured that this pointer is non-null.
- assert(command != 0 /* nullptr */);
if (0 /* nullptr */ == command)
error("cannot apply system request to empty command");
else
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit