[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 02/02: Fix assertion failure on negative space size.
From: |
G. Branden Robinson |
Subject: |
[groff] 02/02: Fix assertion failure on negative space size. |
Date: |
Fri, 8 May 2020 21:07:17 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit c3047d8f5881e21cf4f09c13d88106c71aa25004
Author: G. Branden Robinson <address@hidden>
AuthorDate: Sat May 9 10:55:06 2020 +1000
Fix assertion failure on negative space size.
* src/roff/troff/env.cpp (space_size): If an argument to the .ss request
is negative, throw a range warning and ignore it.
* src/roff/groff/tests/regression_savannah_58337.sh: Add test.
* src/roff/groff/groff.am: Run test.
Fixes https://savannah.gnu.org/bugs/index.php?58337.
---
ChangeLog | 9 +++++++
src/roff/groff/groff.am | 1 +
src/roff/groff/tests/regression_savannah_58337.sh | 32 +++++++++++++++++++++++
src/roff/troff/env.cpp | 11 ++++++--
4 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6d7cdf8..c5f8a55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-05-09 G. Branden Robinson <address@hidden>
+
+ * src/roff/troff/env.cpp (space_size): If an argument to the .ss
+ request is negative, throw a range warning and ignore it.
+ * src/roff/groff/tests/regression_savannah_58337.sh: Add test.
+ * src/roff/groff/groff.am: Run test.
+
+ Fixes https://savannah.gnu.org/bugs/index.php?58337.
+
2020-05-08 G. Branden Robinson <address@hidden>
Update documentation of .ss request.
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index 52fb72c..0089c1b 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -47,6 +47,7 @@ groff_TESTS = \
src/roff/groff/tests/regression_savannah_56555.sh \
src/roff/groff/tests/regression_savannah_58153.sh \
src/roff/groff/tests/regression_savannah_58162.sh \
+ src/roff/groff/tests/regression_savannah_58337.sh \
src/roff/groff/tests/smoke-test_html_device.sh \
src/roff/groff/tests/string_case_xform_errors.sh \
src/roff/groff/tests/string_case_xform_requests.sh \
diff --git a/src/roff/groff/tests/regression_savannah_58337.sh
b/src/roff/groff/tests/regression_savannah_58337.sh
new file mode 100755
index 0000000..55883bf
--- /dev/null
+++ b/src/roff/groff/tests/regression_savannah_58337.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Copyright (C) 2020 Free Software Foundation, Inc.
+#
+# This file is part of groff.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+groff="${abs_top_builddir:-.}/test-groff"
+
+set -e
+
+# groff should ignore negative inter-word and inter-sentence space
+# sizes. And certainly not fail an assertion. Savannah #58337.
+"$groff" -Tascii <<EOF | grep -Fqx 'A B. C.'
+.pl 1v
+.ss -1 -1
+A B.
+C.
+EOF
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index c11d2df..9cbc130 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1292,9 +1292,16 @@ void space_size()
{
int n;
if (get_integer(&n)) {
- curenv->space_size = n;
+ if (n < 0)
+ warning(WARN_RANGE, "negative word space size ignored: '%1'", n);
+ else
+ curenv->space_size = n;
if (has_arg() && get_integer(&n))
- curenv->sentence_space_size = n;
+ if (n < 0)
+ warning(WARN_RANGE, "negative sentence space size ignored:"
+ " '%1'", n);
+ else
+ curenv->sentence_space_size = n;
else
curenv->sentence_space_size = curenv->space_size;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 02/02: Fix assertion failure on negative space size.,
G. Branden Robinson <=