-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
8000
div>
Labels
bugSomething that's not working as intendedSomething that's not working as intended
Milestone
Description
Fedora 28+ sets some hardening options which tighten up potentially-invalid accesses, which cause an assert to fire in string match.
To reproduce, build with glibc (ie Linux only) from HEAD (or 3.0.0) with -D_GLIBCXX_ASSERTIONS, then run ./fish -c 'string match --entire "" -- banana (from the tests).
This crashes with:
/usr/include/c++/6/bits/basic_string.h:997: std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::front() [with _CharT = wchar_t; _Traits = std::char_traits<wchar_t>; _Alloc = std::allocator<wchar_t>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference = wchar_t&]: Assertion '!empty()' failed.
fish: “./fish -c 'string match --entir…” terminated by signal SIGABRT (Abort)
The backtrace follows:
0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007eff100f842a in __GI_abort () at abort.c:89
#2 0x00005585fd330c82 in std::__replacement_assert (__file=__file@entry=0x5585fd40baf8 "/usr/include/c++/6/bits/basic_string.h",
__line=__line@entry=997,
__function=__function@entry=0x5585fd412020 <_ZZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE5frontEvE19__PRETTY_FUNCTION__> "std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::front() [with _CharT = wchar_t; _Traits = std::char_traits<wchar_t>; _Alloc = std::a"..., __condition=__condition@entry=0x5585fd40cd9a "!empty()")
at /usr/include/x86_64-linux-gnu/c++/6/bits/c++config.h:446
#3 0x00005585fd3463cd in std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::front (
this=<optimized out>) at /usr/include/c++/6/bits/basic_string.h:997
#4 wildcard_matcher_t::wildcard_matcher_t (streams=..., opts=..., pattern=L"", this=<optimized out>)
at /home/wheel/zanchey/src/fish-shell/src/builtin_string.cpp:626
#5 make_unique<wildcard_matcher_t, wchar_t*&, wchar_t const*&, options_t&, io_streams_t&> ()
at /home/wheel/zanchey/src/fish-shell/src/common.h:816
#6 string_match (parser=..., streams=..., argc=<optimized out>, argv=0x5585fe36be48)
at /home/wheel/zanchey/src/fish-shell/src/builtin_string.cpp:857
... (boring bits removed)where frame 4 looks like:
#4 wildcard_matcher_t::wildcard_matcher_t (streams=..., opts=..., pattern=L"", this=<optimized out>)
at /home/wheel/zanchey/src/fish-shell/src/builtin_string.cpp:626
621 wcpattern[i] = towlower(wcpattern[i]);
622 }
623 }
624 if (opts.entire) {
625 // If the pattern is empty, this becomes one ANY_STRING that matches everything.
626 if (wcpattern.front() != ANY_STRING) wcpattern.insert(0, 1, ANY_STRING);
627 if (wcpattern.back() != ANY_STRING) wcpattern.push_back(ANY_STRING);
628 }
629 }
630Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething that's not working as intendedSomething that's not working as intended