diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2010-03-23 16:07:56 +0100 |
---|---|---|
committer | Paolo Bonzini <bonzini@gnu.org> | 2010-03-23 16:12:00 +0100 |
commit | 3220317a428d63a4303ffee0fb45becf835cf1fd (patch) | |
tree | 70ffe675e50d2f6e5b7eb0f449f359c2191612d5 /tests/char-class-multibyte | |
parent | 90cc2ba27bd3f368b945f89a60be4220b73baac7 (diff) | |
download | grep-3220317a428d63a4303ffee0fb45becf835cf1fd.tar.gz |
dfa: fix sigsegv on multibyte character classes
Reported by Jaroslav Škarvada <jskarvad@redhat.com>. This is
unfortunate. grep needs an automatic testcase generator.
* NEWS: Document bug.
* THANKS: Mention reporter.
* src/dfa.c (set_bit_casefold): Change type of first argument for
self-documentation.
(parse_bracket_exp): Fix call.
* tests/Makefile.am: Add new testcase.
* tests/char-class-multibyte: New testcase.
Diffstat (limited to 'tests/char-class-multibyte')
-rw-r--r-- | tests/char-class-multibyte | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/char-class-multibyte b/tests/char-class-multibyte new file mode 100644 index 00000000..d77c6de0 --- /dev/null +++ b/tests/char-class-multibyte @@ -0,0 +1,23 @@ +#!/bin/sh +# This would segfault for grep-2.6 +: ${srcdir=.} +. "$srcdir/init.sh"; path_prepend_ ../src + +printf 'É\n' > exp1 || framework_failure +fail=0 + +for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do + out=out1-$LOC + printf 'á\nç\nÉ\n' | LC_ALL=$LOC grep '[é]' > $out || fail=1 + compare $out exp1 || fail=1 +done + +printf 'é\n' > exp2 || framework_failure + +for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do + out=out2-$LOC + printf 'á\nç\né\n' | LC_ALL=$LOC grep '[É]' > $out || fail=1 + compare $out exp2 || fail=1 +done + +Exit $fail |