groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 26/29: [tbl]: Regression-test Savannah #62366.


From: G. Branden Robinson
Subject: [groff] 26/29: [tbl]: Regression-test Savannah #62366.
Date: Tue, 26 Apr 2022 06:40:19 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 19b05a9d1b7f110429cf9df1f3d9d30873d019b2
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Apr 26 18:02:08 2022 +1000

    [tbl]: Regression-test Savannah #62366.
    
    * src/preproc/tbl/tests/do-not-segv-when-backslash-R-in-text-block.sh:
      Do it.
    * src/preproc/tbl/tbl.am (tbl_TESTS): Run test.
    
    Test fails at this commit.
---
 ChangeLog                                          |  8 +++
 src/preproc/tbl/tbl.am                             |  1 +
 .../do-not-segv-when-backslash-R-in-text-block.sh  | 75 ++++++++++++++++++++++
 3 files changed, 84 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index a82860f8..ba4cf219 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-04-27  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [tbl]: Regression-test Savannah #62366.
+
+       * src/preproc/tbl/tests/\
+       do-not-segv-when-backslash-R-in-text-block.sh: Do it.
+       * src/preproc/tbl/tbl.am (tbl_TESTS): Run test.
+
 2022-04-26  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/libs/libgroff/string.cpp (string::extract): Check return
diff --git a/src/preproc/tbl/tbl.am b/src/preproc/tbl/tbl.am
index b2e6b176..e155c76b 100644
--- a/src/preproc/tbl/tbl.am
+++ b/src/preproc/tbl/tbl.am
@@ -28,6 +28,7 @@ tbl_TESTS = \
   src/preproc/tbl/tests/cooperate-with-nm-request.sh \
   src/preproc/tbl/tests/count-continued-input-lines.sh \
   src/preproc/tbl/tests/do-not-segv-on-invalid-vertical-span-entry.sh \
+  src/preproc/tbl/tests/do-not-segv-when-backslash-R-in-text-block.sh \
   src/preproc/tbl/tests/format-time-diagnostics-work.sh \
   src/preproc/tbl/tests/save-and-restore-hyphenation-parameters.sh \
   src/preproc/tbl/tests/save-and-restore-tab-stops.sh
diff --git 
a/src/preproc/tbl/tests/do-not-segv-when-backslash-R-in-text-block.sh 
b/src/preproc/tbl/tests/do-not-segv-when-backslash-R-in-text-block.sh
new file mode 100755
index 00000000..30bd9f6f
--- /dev/null
+++ b/src/preproc/tbl/tests/do-not-segv-when-backslash-R-in-text-block.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+#
+# Copyright (C) 2022 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"
+
+fail=
+
+wail () {
+    echo "...FAILED" >&2
+    fail=yes
+}
+
+# Regression-test Savannah #62366.
+#
+# Do not SEGV when a text block begins with a repeating glyph token, and
+# do not malformat the output if it ends with one.
+
+test -f core && exit 77 # skip
+
+input='.TS
+L.
+T{
+\Ra
+T}
+.TE
+.TS
+L.
+T{
+foo
+\Ra
+T}
+.TE
+.TS
+L.
+T{
+foo
+\Ra
+bar
+T}
+.TE'
+
+output=$(printf "%s\n" "$input" | "$groff" -t -Tascii -P-cbou)
+
+echo "checking that tbl doesn't segfault" >&2
+test -f core && wail
+
+echo "checking text block starting with repeating glyph" >&2
+echo "$output" | sed -n 1p | grep -qx 'a' || wail
+
+echo "checking text block ending with repeating glyph" >&2
+echo "$output" | sed -n 2p | grep -qx 'foo a' || wail
+
+echo "checking text block containing repeating glyph" >&2
+echo "$output" | sed -n 3p | grep -qx 'foo a bar' || wail
+
+test -z "$fail"
+
+# vim:set ai et sw=4 ts=4 tw=72:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]