summaryrefslogtreecommitdiff
path: root/testsuite/invalid-mb-seq-UMR.sh
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2015-05-02 18:22:41 -0700
committerJim Meyering <meyering@fb.com>2015-05-03 10:03:44 -0700
commitaf7a509eaa211217e29e3dd4c44028f76454b5a0 (patch)
treeed2bd0896a167c91c73332249e75bed8b7e49233 /testsuite/invalid-mb-seq-UMR.sh
parent78e8e58ab0635ad9510a2b416d0d66cf0e6f84ff (diff)
downloadsed-af7a509eaa211217e29e3dd4c44028f76454b5a0.tar.gz
tests: test for just-fixed UMR bug
* testsuite/invalid-mb-seq-UMR.sh: New file. Test for just-fixed bug. * testsuite/Makefile.am (T): New variable. Add the two init.sh-using test names here, rather than in two separate lists. (SEDTESTS, EXTRA_DIST): Use $(T). (EXTRA_DIST): Add init.cfg. * testsuite/init.cfg: New file, to add functions from coreutils. (require_valgrind_, print_ver_): New functions.
Diffstat (limited to 'testsuite/invalid-mb-seq-UMR.sh')
-rwxr-xr-xtestsuite/invalid-mb-seq-UMR.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/invalid-mb-seq-UMR.sh b/testsuite/invalid-mb-seq-UMR.sh
new file mode 100755
index 0000000..33b58fc
--- /dev/null
+++ b/testsuite/invalid-mb-seq-UMR.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Inserting an invalid multibyte sequence could lead to
+# reading uninitialized memory.
+
+# Copyright (C) 2015 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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/>.
+. "${srcdir=.}/init.sh"; path_prepend_ ../sed
+print_ver_ sed
+
+require_valgrind_
+
+echo a > in || framework_failure_
+echo bC > exp || framework_failure_
+LC_ALL=ja_JP.eucJP valgrind --quiet --error-exitcode=1 \
+ sed -e 's/a/b\U\xb2c/' in > out 2> err || fail=1
+
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+Exit $fail