Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
294280f737
!32 remove the comment patch03
From: @paulthomas100199 
Reviewed-by: @open-bot 
Signed-off-by: @open-bot
2023-12-14 02:10:48 +00:00
lwg
47872611c9 remove the comment patch03 2023-12-14 09:20:49 +08:00
openeuler-ci-bot
8580bfcb17
!26 fix CVE-2023-49284
From: @paultohmas 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-12-06 08:53:15 +00:00
lwg
587b40380b fix CVE-2023-49284 2023-12-06 11:18:29 +08:00
openeuler-ci-bot
d61b2895de
!15 [sync] PR-14: update changelog fix jul spelling mistake
From: @openeuler-sync-bot 
Reviewed-by: @weigangli 
Signed-off-by: @weigangli
2023-10-07 02:42:22 +00:00
openeuler-ci-bot
605990dcd4
!17 [sync] PR-16: Synchronize the release of 22.03-LTS
From: @openeuler-sync-bot 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2022-12-13 12:01:06 +00:00
starlet-dx
a9fe76069b Synchronize the release of 22.03-LTS
(cherry picked from commit 556b26f93640cd3b9bef119430acf35d9fa10505)
2022-12-13 19:47:35 +08:00
lvfei
04e870d928 update changelog fix date does not match the day of the week
(cherry picked from commit bc2a51e8e511e81e1afe7102be1d8c4059a5fadf)
2022-10-21 14:24:15 +08:00
openeuler-ci-bot
3986ffcd54
!11 Fix CVE-2022-20001 and fix test failure
From: @starlet-dx 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
2022-05-17 00:57:35 +00:00
starlet-dx
ad2f49307b Fix CVE-2022-20001 and fix test failure 2022-05-16 11:00:01 +08:00
4 changed files with 172 additions and 2 deletions

71
CVE-2022-20001.patch Normal file
View File

@ -0,0 +1,71 @@
From 37625053d424c1ab88de2b0c50c7fe71e1468e2c Mon Sep 17 00:00:00 2001
From: ridiculousfish <rf@fishshell.com>
Date: Sun, 26 Dec 2021 17:25:20 -0800
Subject: [PATCH] fish_git_prompt: be careful about git config
fish_git_prompt may run certain git commands which may invoke certain
external programs as specified `.git/config`. Prevent this by suppressing
certain git config options.
---
share/functions/fish_git_prompt.fish | 8 ++++----
tests/checks/git.fish | 15 +++++++++++++++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/share/functions/fish_git_prompt.fish b/share/functions/fish_git_prompt.fish
index 6457e114b60..9920430b9ab 100644
--- a/share/functions/fish_git_prompt.fish
+++ b/share/functions/fish_git_prompt.fish
@@ -345,18 +345,18 @@ function __fish_git_prompt_staged --description "fish_git_prompt helper, tells w
# The "diff" functions all return > 0 if there _is_ a diff,
# but we want to return 0 if there are staged changes.
# So we invert the status.
- not command git diff-index --cached --quiet HEAD -- 2>/dev/null
+ not command git -c core.fsmonitor= diff-index --cached --quiet HEAD -- 2>/dev/null
and echo 1
end
function __fish_git_prompt_untracked --description "fish_git_prompt helper, tells whether or not the current repository has untracked files"
- command git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- :/ >/dev/null 2>&1
+ command git -c core.fsmonitor= ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- :/ >/dev/null 2>&1
and echo 1
end
function __fish_git_prompt_dirty --description "fish_git_prompt helper, tells whether or not the current branch has tracked, modified files"
# Like staged, invert the status because we want 0 to mean there are dirty files.
- not command git diff --no-ext-diff --quiet --exit-code 2>/dev/null
+ not command git -c core.fsmonitor= diff --no-ext-diff --quiet --exit-code 2>/dev/null
and echo 1
end
@@ -372,7 +372,7 @@ function __fish_git_prompt_informative_status
# It's quite a bit faster and unlikely anyone cares about the number of files if it's *all* of the files
# in that directory.
# The v2 format is better, but we don't actually care in this case.
- set -l stats (string sub -l 2 (git status --porcelain -z -unormal | string split0))
+ set -l stats (string sub -l 2 (git -c core.fsmonitor= status --porcelain -z -unormal | string split0))
set -l invalidstate (string match -r '^UU' $stats | count)
set -l stagedstate (string match -r '^[ACDMR].' $stats | count)
set -l dirtystate (string match -r '^.[ACDMR]' $stats | count)
diff --git a/tests/checks/git.fish b/tests/checks/git.fish
index 6f1cafd8c25..a96bc8baccd 100644
--- a/tests/checks/git.fish
+++ b/tests/checks/git.fish
@@ -80,3 +80,18 @@ set -g __fish_git_prompt_status_order untrackedfiles
fish_git_prompt
echo
#CHECK: (newbranch %)
+
+# Turn on everything and verify we correctly ignore sus config files.
+set -g __fish_git_prompt_status_order stagedstate invalidstate dirtystate untrackedfiles stashstate
+set -g __fish_git_prompt_showdirtystate 1
+set -g __fish_git_prompt_show_informative_status 1
+set -g __fish_git_prompt_showuntrackedfiles 1
+rm -Rf .git *
+git init >/dev/null 2>&1
+echo -n > ran.txt
+git config core.fsmonitor 'echo fsmonitor >> ran.txt; false'
+git config core.sshCommand 'echo sshCommand >> ran.txt; false'
+git config diff.external 'echo diff >> ran.txt; false'
+touch untracked_file
+fish_git_prompt > /dev/null
+cat ran.txt # should output nothing

View File

@ -0,0 +1,52 @@
From 09986f5563e31e2c900a606438f1d60d008f3a14 Mon Sep 17 00:00:00 2001
From: Fabian Boehm <FHomborg@gmail.com>
Date: Sat, 2 Dec 2023 11:06:07 +0100
Subject: [PATCH] Encode all ENCODE_DIRECT codepoints with encode_direct
---
src/common.cpp | 7 ++++---
tests/checks/basic.fish | 11 ++++++++++-
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/common.cpp b/src/common.cpp
index c419bc1..bda5fe6 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -355,9 +355,7 @@ static wcstring str2wcs_internal(const char *in, const size_t in_len) {
} else {
ret = std::mbrtowc(&wc, &in[in_pos], in_len - in_pos, &state);
// Determine whether to encode this character with our crazy scheme.
- if (wc >= ENCODE_DIRECT_BASE && wc < ENCODE_DIRECT_BASE + 256) {
- use_encode_direct = true;
- } else if (wc == INTERNAL_SEPARATOR) {
+ if (fish_reserved_codepoint(wc)) {
use_encode_direct = true;
} else if (ret == static_cast<size_t>(-2)) {
// Incomplete sequence.
@@ -1317,6 +1315,9 @@ maybe_t<size_t> read_unquoted_escape(const wchar_t *input, wcstring *result, boo
}
if (!errored && result_char_or_none.has_value()) {
+ if (fish_reserved_codepoint(*result_char_or_none)) {
+ return none();
+ }
result->push_back(*result_char_or_none);
}
if (errored) return none();
diff --git a/tests/checks/basic.fish b/tests/checks/basic.fish
index c9a2d58..83bee8f 100644
--- a/tests/checks/basic.fish
+++ b/tests/checks/basic.fish
@@ -500,3 +500,12 @@ echo banana
# This used to be a parse error - #7685.
echo (echo hello\\)
# CHECK: hello\
+
+$fish -c 'echo \ufdd2"fart"'
+# CHECKRR: fish: Invalid token '\ufdd2"fart"'
+# CHECKRR: echo \ufdd2"fart"
+# CHECHRR: ^~~~~~~~~~~^
+
+echo (sh -c 'printf $\'\ufdd2foo\'') | string escape
+# CHECK: \Xef\Xbf\X92foo
+

View File

@ -1,10 +1,16 @@
Name: fish
Version: 3.3.1
Release: 1
Release: 6
Summary: Friendly interactive shell
License: GPLv2 and BSD and ISC and LGPLv2+ and MIT
URL: https://fishshell.com
Source0: https://github.com/fish-shell/fish-shell/releases/download/%{version}/%{name}-%{version}.tar.xz
# https://github.com/fish-shell/fish-shell/commit/ec8844d834cc9fe626e9fc326c6f5410341d532a
Patch01: fix-test-failure.patch
# https://github.com/fish-shell/fish-shell/commit/37625053d424c1ab88de2b0c50c7fe71e1468e2c
Patch02: CVE-2022-20001.patch
# https://github.com/fish-shell/fish-shell/commit/09986f5563e31e2c900a606438f1d60d008f3a14
Patch03: backport-CVE-2023-49284.patch
BuildRequires: cmake >= 3.2
BuildRequires: ninja-build
@ -97,5 +103,21 @@ fi
%{_datadir}/pixmaps/fish.png
%changelog
* Mon July 12 2021 wulei <wulei80@huawei.com> - 3.3.1-1
* Thu Dec 14 2023 Paul Thomas <paulthomas100199@gmail.com> - 3.3.1-6
- remove the comment patch03
* Wed Dec 06 2023 lwg <relpeace@yeah.net> - 3.3.1-5
- fix CVE-2023-49284
* Mon Dec 12 2022 yaoxin <yaoxin30@h-partners.com> - 3.3.1-4
- Synchronize the release of 22.03-LTS
* Mon Dec 12 2022 yaoxin <yaoxin30@h-partners.com> - 3.3.1-3
- Add comment: https://github.com/fish-shell/fish-shell/commit/ec8844d834cc9fe626e9fc326c6f5410341d532a
* Mon May 16 2022 yaoxin <yaoxin30@h-partners.com> - 3.3.1-2
- Fix CVE-2022-20001
- Fix test failure
* Mon Jul 12 2021 wulei <wulei80@huawei.com> - 3.3.1-1
- Package init

25
fix-test-failure.patch Normal file
View File

@ -0,0 +1,25 @@
From bfe373299fc9a13f3fb05d6bc68c63e79d62dfa0 Mon Sep 17 00:00:00 2001
From: Fabian Homborg <FHomborg@gmail.com>
Date: Thu, 14 Oct 2021 18:18:51 +0200
Subject: [PATCH] Drop tests with resetting match start inside lookaround
---
src/fish_tests.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp
index 2b46986..f1f4865 100644
--- a/src/fish_tests.cpp
+++ b/src/fish_tests.cpp
@@ -5723,8 +5723,6 @@ static void test_string() {
{{L"string", L"match", L"-r", L"-a", L"a*", L"b", 0}, STATUS_CMD_OK, L"\n\n"},
{{L"string", L"match", L"-r", L"foo\\Kbar", L"foobar", 0}, STATUS_CMD_OK, L"bar\n"},
{{L"string", L"match", L"-r", L"(foo)\\Kbar", L"foobar", 0}, STATUS_CMD_OK, L"bar\nfoo\n"},
- {{L"string", L"match", L"-r", L"(?=ab\\K)", L"ab", 0}, STATUS_CMD_OK, L"\n"},
- {{L"string", L"match", L"-r", L"(?=ab\\K)..(?=cd\\K)", L"abcd", 0}, STATUS_CMD_OK, L"\n"},
{{L"string", L"replace", 0}, STATUS_INVALID_ARGS, L""},
{{L"string", L"replace", L"", 0}, STATUS_INVALID_ARGS, L""},
--
2.23.0