From 3220317a428d63a4303ffee0fb45becf835cf1fd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 23 Mar 2010 16:07:56 +0100 Subject: dfa: fix sigsegv on multibyte character classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported by Jaroslav Škarvada . 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. --- tests/char-class-multibyte | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/char-class-multibyte (limited to 'tests/char-class-multibyte') 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 -- cgit v1.2.1