From 29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 11 Apr 2024 10:21:29 +0200 Subject: Adding upstream version 1:0.1.9998svn3589+dfsg. Signed-off-by: Daniel Baumann --- src/grep/tests/kwset-abuse | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 src/grep/tests/kwset-abuse (limited to 'src/grep/tests/kwset-abuse') diff --git a/src/grep/tests/kwset-abuse b/src/grep/tests/kwset-abuse new file mode 100755 index 0000000..bb8911f --- /dev/null +++ b/src/grep/tests/kwset-abuse @@ -0,0 +1,31 @@ +#! /bin/sh +# Evoke a segfault in a hard-to-reach code path of kwset.c. +# This bug affected grep versions 2.19 through 2.21. +# +# Copyright (C) 2015-2021 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 . + +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +fail=0 + +# This test case chooses a haystack of size 260,000, since prodding +# with gdb showed a reallocation slightly larger than that in fillbuf. +# To reach the buggy code, the needle must have length < 1/11 that of +# the haystack, and 10,000 is a nice round number that fits the bill. +printf '%0260000dXy\n' 0 | returns_ 1 grep -F $(printf %010000dy 0) \ + || fail=1 + +Exit $fail -- cgit v1.2.3