bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bash segfaults when using extglob on an empty var


From: Justin Wood (Callek)
Subject: Bash segfaults when using extglob on an empty var
Date: Thu, 13 Oct 2022 14:50:49 -0400

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation 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
uname output: Linux lyra 5.19.14-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Wed
Oct 5 21:31:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 5.2
Patch Level: 2
Release Status: release

Description:
Bash segfaults when using extglob on an empty var. Regression in 5.2.2
compared to 5.1.16

#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:74
#1  0x000055cbe3eb4cd5 in pat_subst (string=string@entry=0x55cbe62cf690 "",
pat=0x55cbe62cf821 "*([.])",
    rep=rep@entry=0x0, mflags=mflags@entry=65) at
/usr/src/debug/bash-5.2.2-1.fc36.x86_64/subst.c:8960
#2  0x000055cbe3eb5737 in parameter_brace_patsub
(varname=varname@entry=0x55cbe6296780
"foo",
    value=value@entry=0x55cbe62959b0 "", estatep=estatep@entry=0x7ffeada25340,
patsub=<optimized out>,
    patsub@entry=0x55cbe62cf560 "#*([.])", quoted=quoted@entry=0,
pflags=pflags@entry=8, flags=0)
    at /usr/src/debug/bash-5.2.2-1.fc36.x86_64/subst.c:9216
#3  0x000055cbe3eb6ffa in parameter_brace_expand
(string=string@entry=0x55cbe6295c70
"${foo/#*([.])}",
    indexp=indexp@entry=0x7ffeada253f4, quoted=quoted@entry=0,
pflags=pflags@entry=8,
    quoted_dollar_atp=quoted_dollar_atp@entry=0x7ffeada254d8,
contains_dollar_at=contains_dollar_at@entry=0x7ffeada254d0)
    at /usr/src/debug/bash-5.2.2-1.fc36.x86_64/subst.c:9960
#4  0x000055cbe3eb92dd in param_expand (string=string@entry=0x55cbe6295c70
"${foo/#*([.])}",
    sindex=sindex@entry=0x7ffeada254dc, quoted=quoted@entry=0,
expanded_something=expanded_something@entry=0x0,
    contains_dollar_at=contains_dollar_at@entry=0x7ffeada254d0,
    quoted_dollar_at_p=quoted_dollar_at_p@entry=0x7ffeada254d8,
had_quoted_null_p=0x7ffeada254d4, pflags=8)
    at /usr/src/debug/bash-5.2.2-1.fc36.x86_64/subst.c:10522

Repeat-By:

        shopt -s extglob
        foo=
        foo=${foo/#*([.])} || echo sad
        #  parens required to reproduce, but unnecessary otherwise.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]