Skip to content

Commit 2593212

Browse files
authored
[Medium] Patch nasm for CVE-2022-46456 (#16149)
1 parent 693d561 commit 2593212

2 files changed

Lines changed: 93 additions & 2 deletions

File tree

SPECS/nasm/CVE-2022-46456.patch

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
From e05867ce3dfe303186f6c66df20251bfd828fd49 Mon Sep 17 00:00:00 2001
2+
From: "H. Peter Anvin" <hpa@zytor.com>
3+
Date: Sat, 30 Aug 2025 16:16:43 -0700
4+
Subject: [PATCH] ndisasm: make the assembler (hopefully) work again
5+
6+
- Significantly overhauled the disassembler internals to make
7+
better use of the information already in the instruction template
8+
and to reduce the implementation differences with the assembler
9+
- Add APX support to the disassembler
10+
- Fix problem with disassembler truncating addresses of jumps
11+
- Fix generation of invalid EAs in 16-bit mode
12+
- Fix array overrun for types in a few modules
13+
- Fix invalid ND flag on near JMP
14+
15+
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
16+
17+
Upstream Patch Reference: https://github.com/netwide-assembler/nasm/commit/e05867ce3dfe303186f6c66df20251bfd828fd49
18+
---
19+
output/outdbg.c | 43 +++++++++++++++++++++++++++++++++++++++----
20+
1 file changed, 39 insertions(+), 4 deletions(-)
21+
22+
diff --git a/output/outdbg.c b/output/outdbg.c
23+
index e7a9a4e..04cb3dd 100644
24+
--- a/output/outdbg.c
25+
+++ b/output/outdbg.c
26+
@@ -408,9 +408,44 @@ dbg_pragma(const struct pragma *pragma)
27+
return DIRR_OK;
28+
}
29+
30+
-static const char * const types[] = {
31+
- "unknown", "label", "byte", "word", "dword", "float", "qword", "tbyte"
32+
-};
33+
+static const char *type_name(uint32_t type)
34+
+{
35+
+ switch (TYM_TYPE(type)) {
36+
+ case TY_UNKNOWN:
37+
+ return "unknown";
38+
+ case TY_LABEL:
39+
+ return "label";
40+
+ case TY_BYTE:
41+
+ return "byte";
42+
+ case TY_WORD:
43+
+ return "word";
44+
+ case TY_DWORD:
45+
+ return "dword";
46+
+ case TY_FLOAT:
47+
+ return "float";
48+
+ case TY_QWORD:
49+
+ return "qword";
50+
+ case TY_TBYTE:
51+
+ return "tbyte";
52+
+ case TY_OWORD:
53+
+ return "oword";
54+
+ case TY_YWORD:
55+
+ return "yword";
56+
+ case TY_ZWORD:
57+
+ return "zword";
58+
+ case TY_COMMON:
59+
+ return "common";
60+
+ case TY_SEG:
61+
+ return "seg";
62+
+ case TY_EXTERN:
63+
+ return "extern";
64+
+ case TY_EQU:
65+
+ return "equ";
66+
+ default:
67+
+ return "<invalid type code>";
68+
+ }
69+
+}
70+
+
71+
static void dbgdbg_init(void)
72+
{
73+
fprintf(ofile, "dbg init: debug information enabled\n");
74+
@@ -457,7 +492,7 @@ static void dbgdbg_output(int output_type, void *param)
75+
static void dbgdbg_typevalue(int32_t type)
76+
{
77+
fprintf(ofile, "dbg typevalue: %s(%"PRIX32")\n",
78+
- types[TYM_TYPE(type) >> 3], TYM_ELEMENTS(type));
79+
+ type_name(type), TYM_ELEMENTS(type));
80+
}
81+
82+
static void
83+
--
84+
2.45.4
85+

SPECS/nasm/nasm.spec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
Summary: Netwide Assembler.
22
Name: nasm
33
Version: 2.16.01
4-
Release: 1%{?dist}
4+
Release: 2%{?dist}
55
License: BSD
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
88
Group: System Environment/Libraries
99
URL: https://www.nasm.us
1010
Source0: http://www.nasm.us/pub/nasm/releasebuilds/%{version}/%{name}-%{version}.tar.gz
11+
Patch0: CVE-2022-46456.patch
12+
BuildRequires: perl
13+
BuildRequires: perl(File::Find)
1114
ExclusiveArch: x86_64
1215

1316
%description
1417
NASM (Netwide Assembler) is an 80x86 assembler designed for portability and modularity. It includes a disassembler as well.
1518

1619
%prep
17-
%setup -q
20+
%autosetup -p1
1821

1922
%build
2023
%configure
@@ -33,6 +36,9 @@ make %{?_smp_mflags} -k test
3336
%{_datadir}/*
3437

3538
%changelog
39+
* Mon Mar 09 2026 Ratiranjan Behera <v-ratbehera@microsoft.com> - 2.16.01-2
40+
- Add patch for CVE-2022-46456
41+
3642
* Fri Oct 27 2023 CBL-Mariner Servicing Account <cblmargh@microsoft.com> - 2.16.01-1
3743
- Auto-upgrade to 2.16.01 - Azure Linux 3.0 - package upgrades
3844

0 commit comments

Comments
 (0)