Subject: grep-3.6 stack-overflow test fails on fedora rawhide

From: Jaroslav Skarvada <[email-masked]>
Date: Thu, 25 Mar 2021 14:53:18 -0400 (EDT)

Hi,

on fedora rawhide the stack-overflow test is failing for grep-3.6:
...
stack-overflow: failed test: grep never printed "stack overflow"
FAIL: stack-overflow
..

Manual run:
# ASAN_OPTIONS=help=true grep --version 2>&1 | grep -q AddressSanitizer
# echo $?
1

# i=3;printf %0${i}0000d 0|tr 0 '(' > in
# ./grep -E -f in
Segmentation fault (core dumped)

Running through valgrind:
==58== Process terminating with default action of signal 11 (SIGSEGV)
==58==  Access not within mapped region at address 0x1FFE801FF8
==58== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==58==    at 0x49A418A: peek_token (in /usr/lib64/libc-2.33.9000.so)
==58==  If you believe this happened as a result of a stack
==58==  overflow in your program's main thread (unlikely but
==58==  possible), you can try to increase the size of the
==58==  main thread stack using the --main-stacksize= flag.
==58==  The main thread stack size used in this run was 8388608.

Compiled with:
CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '

thanks & regards

Jaroslav