From 2f6003297a6187e5b413ae0f565d66fee3d2ff3c Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Jan 05 2019 08:48:14 +0000 Subject: Fix crash in 'string match' subcommand Signed-off-by: Igor Gnatenko --- diff --git a/0001-string-Fix-crash-with-_GLIBCXX_ASSERTIONS.patch b/0001-string-Fix-crash-with-_GLIBCXX_ASSERTIONS.patch new file mode 100644 index 0000000..4b4b9c5 --- /dev/null +++ b/0001-string-Fix-crash-with-_GLIBCXX_ASSERTIONS.patch @@ -0,0 +1,38 @@ +From 9d4e460b298a39ee2be2443af97413e7063fa8d2 Mon Sep 17 00:00:00 2001 +From: Fabian Homborg +Date: Fri, 4 Jan 2019 08:45:53 +0100 +Subject: [PATCH] string: Fix crash with _GLIBCXX_ASSERTIONS + +This asserted because we accessed wcstring::front() when it was empty. + +Instead, check explicitly for it being empty before. + +Fixes #5479 +--- + src/builtin_string.cpp | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/src/builtin_string.cpp b/src/builtin_string.cpp +index 6e810a32..bbc7e40c 100644 +--- a/src/builtin_string.cpp ++++ b/src/builtin_string.cpp +@@ -622,9 +622,13 @@ class wildcard_matcher_t : public string_matcher_t { + } + } + if (opts.entire) { +- // If the pattern is empty, this becomes one ANY_STRING that matches everything. +- if (wcpattern.front() != ANY_STRING) wcpattern.insert(0, 1, ANY_STRING); +- if (wcpattern.back() != ANY_STRING) wcpattern.push_back(ANY_STRING); ++ if (!wcpattern.empty()) { ++ if (wcpattern.front() != ANY_STRING) wcpattern.insert(0, 1, ANY_STRING); ++ if (wcpattern.back() != ANY_STRING) wcpattern.push_back(ANY_STRING); ++ } else { ++ // If the pattern is empty, this becomes one ANY_STRING that matches everything. ++ wcpattern.push_back(ANY_STRING); ++ } + } + } + +-- +2.20.1 + diff --git a/fish.spec b/fish.spec index 8c70826..3d54c1e 100644 --- a/fish.spec +++ b/fish.spec @@ -4,7 +4,7 @@ Name: fish Version: 3.0.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Friendly interactive shell # GPLv2 @@ -29,6 +29,8 @@ URL: https://fishshell.com Source0: https://github.com/fish-shell/fish-shell/releases/download/%{version}/%{name}-%{version}.tar.gz # https://github.com/fish-shell/fish-shell/commit/742fde0dd68858ad603b449501f0c42cd7864fab Patch0001: 0001-Don-t-use-less-in-highlighting-test.patch +# https://github.com/fish-shell/fish-shell/commit/9d4e460b298a39ee2be2443af97413e7063fa8d2 +Patch0002: 0001-string-Fix-crash-with-_GLIBCXX_ASSERTIONS.patch BuildRequires: cmake >= 3.2 BuildRequires: ninja-build @@ -109,6 +111,9 @@ fi %{_pkgdocdir} %changelog +* Sat Jan 05 2019 Igor Gnatenko - 3.0.0-4 +- Fix crash in 'string match' subcommand + * Sun Dec 30 2018 Igor Gnatenko - 3.0.0-3 - Switch to CMake/Ninja