Skip to content

Commit faff69a

Browse files
[Medium] Patch yasm for CVE-2023-51258 & CVE-2023-37732 (#13795)
1 parent e6f9f5c commit faff69a

File tree

3 files changed

+79
-1
lines changed

3 files changed

+79
-1
lines changed

SPECS/yasm/CVE-2023-37732.patch

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From a8196f22eccfd6e2b934dfdb4f8dac97d7e6c1f3 Mon Sep 17 00:00:00 2001
2+
From: akhila-guruju <v-guakhila@microsoft.com>
3+
Date: Wed, 14 May 2025 07:35:12 +0000
4+
Subject: [PATCH] Address CVE-2023-37732
5+
6+
Upstream patch reference: https://github.com/yasm/yasm/commit/2cd3bb50e256f5ed5f611ac611d25fe673f2cec3
7+
8+
---
9+
modules/objfmts/elf/elf.c | 10 +++++-----
10+
1 file changed, 5 insertions(+), 5 deletions(-)
11+
12+
diff --git a/modules/objfmts/elf/elf.c b/modules/objfmts/elf/elf.c
13+
index 2486bba..bab4c9c 100644
14+
--- a/modules/objfmts/elf/elf.c
15+
+++ b/modules/objfmts/elf/elf.c
16+
@@ -482,15 +482,15 @@ elf_symtab_write_to_file(FILE *f, elf_symtab_head *symtab,
17+
18+
/* get size (if specified); expr overrides stored integer */
19+
if (entry->xsize) {
20+
- size_intn = yasm_intnum_copy(
21+
- yasm_expr_get_intnum(&entry->xsize, 1));
22+
- if (!size_intn) {
23+
+ yasm_intnum *intn = yasm_expr_get_intnum(&entry->xsize, 1);
24+
+ if (!intn) {
25+
yasm_error_set(YASM_ERROR_VALUE,
26+
N_("size specifier not an integer expression"));
27+
yasm_errwarn_propagate(errwarns, entry->xsize->line);
28+
- }
29+
+ } else
30+
+ size_intn = yasm_intnum_copy(intn);
31+
}
32+
- else
33+
+ if (!size_intn)
34+
size_intn = yasm_intnum_create_uint(entry->size);
35+
36+
/* get EQU value for constants */
37+
--
38+
2.45.2
39+

SPECS/yasm/CVE-2023-51258.patch

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From fd85453926e43073dc785ec0cc02a10fe2dd2794 Mon Sep 17 00:00:00 2001
2+
From: akhila-guruju <v-guakhila@microsoft.com>
3+
Date: Wed, 14 May 2025 07:13:01 +0000
4+
Subject: [PATCH] Address CVE-2023-51258
5+
6+
Upstream patch reference: https://github.com/yasm/yasm/pull/264/commits/eeee94bfd6dd18af8b1508c1804d93cf20ef44e6
7+
8+
---
9+
modules/preprocs/nasm/nasm-pp.c | 2 ++
10+
1 file changed, 2 insertions(+)
11+
12+
diff --git a/modules/preprocs/nasm/nasm-pp.c b/modules/preprocs/nasm/nasm-pp.c
13+
index 27a8cc6..76df757 100644
14+
--- a/modules/preprocs/nasm/nasm-pp.c
15+
+++ b/modules/preprocs/nasm/nasm-pp.c
16+
@@ -3091,6 +3091,7 @@ do_directive(Token * tline)
17+
{
18+
error(ERR_NONFATAL, "`%s': not defining a macro",
19+
tline->text);
20+
+ free_tlist(origline);
21+
return DIRECTIVE_FOUND;
22+
}
23+
k = hash(defining->name);
24+
@@ -3188,6 +3189,7 @@ do_directive(Token * tline)
25+
{
26+
error(ERR_NONFATAL, "non-constant value given to `%%rep'");
27+
yasm_expr_destroy(evalresult);
28+
+ free_tlist(origline);
29+
return DIRECTIVE_FOUND;
30+
}
31+
i = (int)yasm_intnum_get_int(intn) + 1;
32+
--
33+
2.45.2
34+

SPECS/yasm/yasm.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: Modular Assembler
22
Name: yasm
33
Version: 1.3.0
4-
Release: 15%{?dist}
4+
Release: 16%{?dist}
55
License: BSD and (GPLv2+ or Artistic or LGPLv2+) and LGPLv2
66
URL: https://yasm.tortall.net/
77
Vendor: Microsoft Corporation
@@ -10,6 +10,8 @@ Source0: https://www.tortall.net/projects/%{name}/releases/%{name}-%{vers
1010
Patch1: 0001-Update-elf-objfmt.c.patch
1111
Patch2: CVE-2023-31975.patch
1212
Patch3: CVE-2021-33454.patch
13+
Patch4: CVE-2023-51258.patch
14+
Patch5: CVE-2023-37732.patch
1315

1416
BuildRequires: gcc
1517
BuildRequires: bison
@@ -74,6 +76,9 @@ make install DESTDIR=%{buildroot}
7476

7577

7678
%changelog
79+
* Wed May 14 2025 Akhila Guruju <v-guakhila@microsoft.com> - 1.3.0-16
80+
- Patch CVE-2023-51258 and CVE-2023-37732
81+
7782
* Tue Jun 18 2024 Saul Paredes <saulparedes@microsoft.com> - 1.3.0-15
7883
- Apply upstream patch for CVE-2021-33454
7984

0 commit comments

Comments
 (0)