1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

nasm: fix CVE-2022-46457

NASM v2.16 was discovered to contain a segmentation violation
in the component ieee_write_file at /output/outieee.c.

References:
https://nvd.nist.gov/vuln/detail/CVE-2022-46457

Upstream patches:
https://github.com/netwide-assembler/nasm/commit/c8af73112027fad0ecbb277e9cba257678c405af

(From OE-Core rev: 6b82d998184112c42b4298aef6a0b9e314fc8ee4)

Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
Archana Polampalli
2023-06-19 10:23:37 +00:00
committed by Steve Sakoman
parent ab6c16cb55
commit 55724a7c45
2 changed files with 51 additions and 0 deletions
@@ -0,0 +1,50 @@
From c8af73112027fad0ecbb277e9cba257678c405af Mon Sep 17 00:00:00 2001
From: "H. Peter Anvin" <hpa@zytor.com>
Date: Wed, 7 Dec 2022 10:23:46 -0800
Subject: [PATCH] outieee: fix segfault on empty input
Fix the IEEE backend crashing if the input file is empty.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Upstream-Status: Backport [https://github.com/netwide-assembler/nasm/commit/c8af73112027fad0ecbb277e9cba257678c405af]
CVE: CVE-2022-46457
Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
---
output/outieee.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/output/outieee.c b/output/outieee.c
index cdb8333..8bc5eaa 100644
--- a/output/outieee.c
+++ b/output/outieee.c
@@ -919,7 +919,7 @@ static void ieee_write_file(void)
* Write the section headers
*/
seg = seghead;
- if (!debuginfo && !strcmp(seg->name, "??LINE"))
+ if (!debuginfo && seg && !strcmp(seg->name, "??LINE"))
seg = seg->next;
while (seg) {
char buf[256];
@@ -954,7 +954,7 @@ static void ieee_write_file(void)
/*
* write the start address if there is one
*/
- if (ieee_entry_seg) {
+ if (ieee_entry_seg && seghead) {
for (seg = seghead; seg; seg = seg->next)
if (seg->index == ieee_entry_seg)
break;
@@ -1067,7 +1067,7 @@ static void ieee_write_file(void)
* put out section data;
*/
seg = seghead;
- if (!debuginfo && !strcmp(seg->name, "??LINE"))
+ if (!debuginfo && seg && !strcmp(seg->name, "??LINE"))
seg = seg->next;
while (seg) {
if (seg->currentpos) {
--
2.40.0
@@ -9,6 +9,7 @@ SRC_URI = "http://www.nasm.us/pub/nasm/releasebuilds/${PV}/nasm-${PV}.tar.bz2 \
file://0001-stdlib-Add-strlcat.patch \
file://0002-Add-debug-prefix-map-option.patch \
file://CVE-2022-44370.patch \
file://CVE-2022-46457.patch \
"
SRC_URI[sha256sum] = "3c4b8339e5ab54b1bcb2316101f8985a5da50a3f9e504d43fa6f35668bee2fd0"