Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
3e6a5836c4
!50 [sync] PR-45: 修复 CVE-2020-21528
From: @openeuler-sync-bot 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-09-12 07:18:11 +00:00
hongjinghao
8b90a595c8 fix CVE-2020-21528
(cherry picked from commit 663428545eaa782a7077af359b786b66c02799c5)
2023-09-12 14:25:42 +08:00
openeuler-ci-bot
3ee3cbb607
!40 [sync] PR-37: Fix CVE-2022-44370
From: @openeuler-sync-bot 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-04-12 10:35:05 +00:00
starlet-dx
5df42a1a9b Fix CVE-2022-44370
(cherry picked from commit a5eae9aa51c5c7643d66e128216739df714ffd27)
2023-04-12 16:58:41 +08:00
openeuler-ci-bot
fcb783ec92
!33 Fix help info error
From: @wk333 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-02-14 09:40:03 +00:00
wk333
44e8b74ca9 Fix help info error 2023-02-14 17:29:36 +08:00
openeuler-ci-bot
74d665d614
!28 fix several issues
From: @zhangruifang2020 
Reviewed-by: @licihua, @caodongxia 
Signed-off-by: @licihua, @caodongxia
2022-10-31 06:41:13 +00:00
zhangruifang2020
d1017025b8 fix several issues 2022-10-22 11:26:25 +08:00
openeuler-ci-bot
aed1410c99 !20 enable make check
From: @extinctfire
Reviewed-by: @licihua
Signed-off-by: @licihua
2021-12-02 01:08:44 +00:00
ExtinctFire
ab8898cd55 enable make check
Signed-off-by: ExtinctFire <shenyining_00@126.com>
2021-11-27 11:14:44 +08:00
5 changed files with 226 additions and 5 deletions

43
CVE-2020-21528.patch Normal file
View File

@ -0,0 +1,43 @@
From 93c774d482694643cafbc82578ac8b729fb5bc8b Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov@gmail.com>
Date: Wed, 4 Nov 2020 13:08:06 +0300
Subject: [PATCH] BR3392637: output/outieee: Fix nil dereference
The handling been broken in commit 98578071.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
output/outieee.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/output/outieee.c b/output/outieee.c
index bff2f085..b3ccc5f6 100644
--- a/output/outieee.c
+++ b/output/outieee.c
@@ -795,6 +795,23 @@ static int32_t ieee_segment(char *name, int *bits)
define_label(name, seg->index + 1, 0L, false);
ieee_seg_needs_update = NULL;
+ /*
+ * In commit 98578071b9d71ecaa2344dd9c185237c1765041e
+ * we reworked labels significantly which in turn lead
+ * to the case where seg->name = NULL here and we get
+ * nil dereference in next segments definitions.
+ *
+ * Lets placate this case with explicit name setting
+ * if labels engine didn't set it yet.
+ *
+ * FIXME: Need to revisit this moment if such fix doesn't
+ * break anything but since IEEE 695 format is veeery
+ * old I don't expect there are many users left. In worst
+ * case this should only lead to a memory leak.
+ */
+ if (!seg->name)
+ seg->name = nasm_strdup(name);
+
if (seg->use32)
*bits = 32;
else
--
2.27.0

94
CVE-2022-44370.patch Normal file
View File

@ -0,0 +1,94 @@
From 2d4e6952417ec6f08b6f135d2b5d0e19b7dae30d Mon Sep 17 00:00:00 2001
From: "H. Peter Anvin" <hpa@zytor.com>
Date: Mon, 7 Nov 2022 10:26:03 -0800
Subject: [PATCH] quote_for_pmake: fix counter underrun resulting in segfault
while (nbs--) { ... } ends with nbs == -1. Rather than a minimal fix,
introduce mempset() to make these kinds of errors less likely in the
future.
Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392815
Reported-by: <13579and24680@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
asm/nasm.c | 12 +++++-------
configure.ac | 1 +
include/compiler.h | 7 +++++++
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/asm/nasm.c b/asm/nasm.c
index 6af927547..1e337c7ba 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2020 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2022 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -817,8 +817,7 @@ static char *quote_for_pmake(const char *str)
}
/* Convert N backslashes at the end of filename to 2N backslashes */
- if (nbs)
- n += nbs;
+ n += nbs;
os = q = nasm_malloc(n);
@@ -827,10 +826,10 @@ static char *quote_for_pmake(const char *str)
switch (*p) {
case ' ':
case '\t':
- while (nbs--)
- *q++ = '\\';
+ q = mempset(q, '\\', nbs);
*q++ = '\\';
*q++ = *p;
+ nbs = 0;
break;
case '$':
*q++ = *p;
@@ -852,9 +851,8 @@ static char *quote_for_pmake(const char *str)
break;
}
}
- while (nbs--)
- *q++ = '\\';
+ q = mempset(q, '\\', nbs);
*q = '\0';
return os;
diff --git a/configure.ac b/configure.ac
index 04a9f648b..42cd19884 100644
--- a/configure.ac
+++ b/configure.ac
@@ -200,6 +200,7 @@ AC_CHECK_FUNCS(strrchrnul)
AC_CHECK_FUNCS(iscntrl)
AC_CHECK_FUNCS(isascii)
AC_CHECK_FUNCS(mempcpy)
+AC_CHECK_FUNCS(mempset)
AC_CHECK_FUNCS(getuid)
AC_CHECK_FUNCS(getgid)
diff --git a/include/compiler.h b/include/compiler.h
index c5bac6e57..407c16093 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -252,6 +252,13 @@ static inline void *mempcpy(void *dst, const void *src, size_t n)
}
#endif
+#ifndef HAVE_MEMPSET
+static inline void *mempset(void *dst, int c, size_t n)
+{
+ return (char *)memset(dst, c, n) + n;
+}
+#endif
+
/*
* Hack to support external-linkage inline functions
*/

30
enable-make-check.patch Normal file
View File

@ -0,0 +1,30 @@
From 4d663e5249f94b49d7af474c345f96a4b9ffd931 Mon Sep 17 00:00:00 2001
From: ExtinctFire <shenyining_00@126.com>
Date: Sat, 27 Nov 2021 09:44:16 +0800
Subject: [PATCH] add check summary
Signed-off-by: ExtinctFire <shenyining_00@126.com>
---
Makefile.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 5725ed3..9282215 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -497,10 +497,10 @@ splint:
splint -weak *.c
test: nasm$(X)
- cd test && $(RUNPERL) performtest.pl --nasm=../nasm *.asm
+ cd test && $(RUNPERL) performtest.pl --nasm=../nasm *.asm --verbose
golden: nasm$(X)
- cd test && $(RUNPERL) performtest.pl --golden --nasm=../nasm *.asm
+ cd test && $(RUNPERL) performtest.pl --golden --nasm=../nasm *.asm --verbose
travis: nasm$(X)
$(PYTHON3) travis/nasm-t.py run
--
2.23.0

28
fix-help-info-error.patch Normal file
View File

@ -0,0 +1,28 @@
From e5987111a8fc89ed86e43ab81e0805d958c61b2c Mon Sep 17 00:00:00 2001
From: yangchenguang <yangchenguang@uniontech.com>
Date: Thu, 19 Jan 2023 13:27:29 +0800
Subject: [PATCH] fix help info error
Signed-off-by: yangchenguang <yangchenguang@uniontech.com>
---
asm/nasm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/asm/nasm.c b/asm/nasm.c
index e5ae89a..e00408b 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -2293,8 +2293,8 @@ static void help(FILE *out)
"\n"
" --prefix str prepend the given string to the names of all extern,\n"
" common and global symbols (also --gprefix)\n"
- " --suffix str append the given string to the names of all extern,\n"
- " common and global symbols (also --gprefix)\n"
+ " --postfix str append the given string to the names of all extern,\n"
+ " common and global symbols (also --gpostfix)\n"
" --lprefix str prepend the given string to local symbols\n"
" --lpostfix str append the given string to local symbols\n"
"\n"
--
2.20.1

View File

@ -8,19 +8,25 @@
Name: nasm
Version: 2.15.05
Release: 1
Release: 6
Summary: The Netwide Assembler, a portable x86 assembler with Intel-like syntax
License: BSD
URL: http://www.nasm.us
Source0: http://www.nasm.us/pub/nasm/releasebuilds/%{version}/%{name}-%{version}.tar.bz2
Source1: http://www.nasm.us/pub/nasm/releasebuilds/%{version}/%{name}-%{version}-xdoc.tar.bz2
Patch6000: enable-make-check.patch
Patch6001: fix-help-info-error.patch
# https://github.com/netwide-assembler/nasm/commit/2d4e6952417ec6f08b6f135d2b5d0e19b7dae30d
Patch6002: CVE-2022-44370.patch
#https://bugzilla.nasm.us/attachment.cgi?id=411648
Patch6003: CVE-2020-21528.patch
BuildRequires: perl(Env) autoconf asciidoc xmlto gcc make git
Provides: %{name}-rdoff
Obsoletes: %{name}-rdoff
Obsoletes: %{name}-rdoff < %{version}-%{release}
%description
NASM is the Netwide Assembler, a free portable assembler for the Intel
@ -36,7 +42,7 @@ BuildRequires: perl(Sort::Versions)
BuildRequires: adobe-source-sans-pro-fonts adobe-source-code-pro-fonts
BuildRequires: ghostscript
Provides: %{name}-doc
Obsoletes: %{name}-doc
Obsoletes: %{name}-doc < %{version}-%{release}
%endif
BuildArch: noarch
@ -59,6 +65,10 @@ make all %{?_smp_mflags}
%install
%make_install install_rdf
%check
make golden
make test
%files
%doc CHANGES README.md
%license AUTHORS
@ -84,10 +94,26 @@ make all %{?_smp_mflags}
%{_mandir}/man1/ld*
%changelog
* Wed Aug 23 2023 hongjinghao <hongjinghao@huawei.com> - 2.15.05-6
- Fix CVE-2020-21528
* Wed Apr 12 2023 yaoxin <yao_xin001@hoperun.com> - 2.15.05-5
- Fix CVE-2022-44370
* Thu Jan 19 2023 yangchenguang <yangchenguang@uniontech.com> - 2.15.05-4
- Fix help info error
* Sat Oct 22 2022 zhangruifang <zhangruifang1@h-partners.com> - 2.15.05-3
- add version number for Obsoletes
- fix bogus date in changelog
* Sat Nov 27 2021 ExtinctFire <shenyining_00@126.com> - 2.15.05-2
- enable make check
* Thu Jan 28 2021 liudabo <liudabo1@huawei.com> - 2.15.05-1
- upgrade version to 2.15.05
* Thu Jan 07 2020 shixuantong <shixuantong@huawei.com> - 2.15.03-2
* Thu Jan 07 2021 shixuantong <shixuantong@huawei.com> - 2.15.03-2
- fix CVE-2019-20352 CVE-2020-24241
* Thu Jul 23 2020 shixuantong <shixuantong@huawei.com> - 2.15.03-1