[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 03/20: [pic]: Fix Savannah #64488 (`lf` request usage).
From: |
G. Branden Robinson |
Subject: |
[groff] 03/20: [pic]: Fix Savannah #64488 (`lf` request usage). |
Date: |
Wed, 2 Aug 2023 12:46:38 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 705be31107334c00f7d963cca5f9e896b91b1022
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Jul 29 05:25:03 2023 -0500
[pic]: Fix Savannah #64488 (`lf` request usage).
* src/preproc/pic/troff.cpp (troff_output::set_location): Do more
parameter validation. Don't generate the two-argument form of the
`lf` request if the C string holding the new file name to write isn't
a null pointer. Also `assert()` this since it should be an invariant.
Fixes <https://savannah.gnu.org/bugs/?64488>. Thanks to Bjarni Ingi
Gislason for the report.
---
ChangeLog | 11 +++++++++++
src/preproc/pic/troff.cpp | 12 +++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9e697e83f..7785482a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-07-29 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/preproc/pic/troff.cpp (troff_output::set_location): Do
+ more parameter validation. Don't generate the two-argument form
+ of the `lf` request if the C string holding the new file name to
+ write isn't a null pointer. Also `assert()` this since it
+ should be an invariant.
+
+ Fixes <https://savannah.gnu.org/bugs/?64488>. Thanks to Bjarni
+ Ingi Gislason for the report.
+
2023-07-28 G. Branden Robinson <g.branden.robinson@gmail.com>
[gxditview]: Add accelerators for "Print" action.
diff --git a/src/preproc/pic/troff.cpp b/src/preproc/pic/troff.cpp
index 3dc87a721..c66e43e2f 100644
--- a/src/preproc/pic/troff.cpp
+++ b/src/preproc/pic/troff.cpp
@@ -554,22 +554,24 @@ void troff_output::dot(const position ¢, const
line_type <)
"\\v'%.3fi+%.2fm'"
".\n.sp -1\n",
c.x,
- c.y,
+ c.y,
DOT_AXIS);
}
}
void troff_output::set_location(const char *s, int n)
{
- if (last_filename != 0 && strcmp(s, last_filename) == 0)
- printf(".lf %d\n", n);
- else {
+ assert(s != 0 /* nullptr */);
+ if ((s != 0 /* nullptr */) && (last_filename != 0 /* nullptr */)
+ && strcmp(s, last_filename) == 0) {
printf(".lf %d %s\n", n, s);
char *lfn = strdup(s);
- if (0 == lfn)
+ if (0 /* nullptr */ == lfn)
fatal("memory allocation failure while copying file name");
last_filename = lfn;
}
+ else
+ printf(".lf %d\n", n);
}
// Local Variables:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 03/20: [pic]: Fix Savannah #64488 (`lf` request usage).,
G. Branden Robinson <=