From 217221617d985a4da2358f1125fe3fd3b19dc357 Mon Sep 17 00:00:00 2001 From: wangyuhang Date: Tue, 7 May 2024 19:16:55 +0800 Subject: [PATCH] solve the problem of dereference null return value when moving a job to the head of the linked list and reorder patches --- ...-Fix-handling-of-skipped-directories.patch | 4 +-- ksh.spec | 8 +++-- skip-some-test.patch | 2 +- ...m-of-dereference-null-return-value-w.patch | 32 +++++++++++++++++++ 4 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 solve-the-problem-of-dereference-null-return-value-w.patch diff --git a/backport-Fix-handling-of-skipped-directories.patch b/backport-Fix-handling-of-skipped-directories.patch index 4f76a4e..e873f42 100644 --- a/backport-Fix-handling-of-skipped-directories.patch +++ b/backport-Fix-handling-of-skipped-directories.patch @@ -113,8 +113,8 @@ index 6a07d7c..26f2d43 100644 ['attributes'], + ['autoload'], ['basic', 90], - ['case'], - ['comvar'], + ['bracket'], + ['builtins'], -- 1.8.3.1 diff --git a/ksh.spec b/ksh.spec index f621cab..e84f76d 100644 --- a/ksh.spec +++ b/ksh.spec @@ -1,6 +1,6 @@ Name: ksh Version: 2020.0.0 -Release: 10 +Release: 11 Summary: The Original ATT Korn Shell License: EPL-1.0 URL: http://www.kornshell.com/ @@ -15,9 +15,10 @@ Patch1: CVE-2019-14868.patch Patch6000: backport-Fix-hist_nearend.patch Patch6001: backport-functions-with-not-loaded-autoloaded-functions.patch Patch6002: backport-Fix-interactive-restricted-shell-behavior.patch +Patch6003: backport-Fix-handling-of-skipped-directories.patch Patch9000: skip-some-test.patch -Patch9001: backport-Fix-handling-of-skipped-directories.patch +Patch9001: solve-the-problem-of-dereference-null-return-value-w.patch Provides: /bin/ksh /usr/bin/ksh BuildRequires: meson gcc glibc-devel ed @@ -94,6 +95,9 @@ done %config(noreplace) %{_sysconfdir}/binfmt.d/kshcomp.conf %changelog +* Tue May 7 2024 wangyuhang - 1:2020.0.0-11 +- solve the problem of dereference null return value when moving a job to the head of the linked list and reorder patches + * Fri Dec 2 2022 wangyuhang - 1:2020.0.0-10 - Type:bugfix - CVE:NA diff --git a/skip-some-test.patch b/skip-some-test.patch index 0983d5b..33ea62a 100644 --- a/skip-some-test.patch +++ b/skip-some-test.patch @@ -133,8 +133,8 @@ index 6a07d7c..96ca5bc 100644 ['b_times.exp'], ['b_ulimit'], @@ -49,8 +46,6 @@ all_tests = [ - ['arrays2'], ['attributes'], + ['autoload'], ['basic', 90], - ['bracket'], - ['builtins'], diff --git a/solve-the-problem-of-dereference-null-return-value-w.patch b/solve-the-problem-of-dereference-null-return-value-w.patch new file mode 100644 index 0000000..2f52837 --- /dev/null +++ b/solve-the-problem-of-dereference-null-return-value-w.patch @@ -0,0 +1,32 @@ +From ed22939428be3bd676e4261cf96e144c15d4e686 Mon Sep 17 00:00:00 2001 +From: wangyuhang +Date: Tue, 2 Apr 2024 15:44:35 +0800 +Subject: [PATCH] solve the problem of dereference null return value when + moving a job to the head of the linked list + +--- + src/cmd/ksh93/sh/jobs.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/cmd/ksh93/sh/jobs.c b/src/cmd/ksh93/sh/jobs.c +index 5ad42c0..a46de01 100644 +--- a/src/cmd/ksh93/sh/jobs.c ++++ b/src/cmd/ksh93/sh/jobs.c +@@ -1105,10 +1105,11 @@ int job_post(Shell_t *shp, pid_t pid, pid_t join) { + val = job.curjobid; + } + // If job to join is not first move it to front. +- if (val) { ++ if (val && job.pwlist) { + pw = job_byjid(val); +- assert(pw); +- if (pw != job.pwlist) { ++ if (!pw) ++ errormsg(SH_DICT, ERROR_warn(0), "the job cannot be found in the linked list"); ++ if (pw && (pw != job.pwlist)) { + job_unlink(pw); + pw->p_nxtjob = job.pwlist; + job.pwlist = pw; +-- +2.33.0 + -- Gitee