Skip to content

Commit cdb876a

Browse files
authored
ruby: Patch CVE-2024-27282 (#9138)
1 parent 1e04206 commit cdb876a

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

SPECS/ruby/CVE-2024-27282.patch

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
From 989a2355808a63fc45367785c82ffd46d18c900a Mon Sep 17 00:00:00 2001
2+
From: Hiroshi SHIBATA <hsbt@ruby-lang.org>
3+
Date: Fri, 12 Apr 2024 15:01:47 +1000
4+
Subject: [PATCH] Fix Use-After-Free issue for Regexp
5+
6+
Co-authored-by: Isaac Peka <7493006+isaac-peka@users.noreply.github.com>
7+
---
8+
regexec.c | 2 +-
9+
1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+
diff --git a/regexec.c b/regexec.c
12+
index 73694ab14a0b0a..140691ad42489f 100644
13+
--- a/regexec.c
14+
+++ b/regexec.c
15+
@@ -3449,8 +3449,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
16+
CASE(OP_MEMORY_END_PUSH_REC) MOP_IN(OP_MEMORY_END_PUSH_REC);
17+
GET_MEMNUM_INC(mem, p);
18+
STACK_GET_MEM_START(mem, stkp); /* should be before push mem-end. */
19+
- STACK_PUSH_MEM_END(mem, s);
20+
mem_start_stk[mem] = GET_STACK_INDEX(stkp);
21+
+ STACK_PUSH_MEM_END(mem, s);
22+
MOP_OUT;
23+
JUMP;
24+

SPECS/ruby/ruby.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Name: ruby
8383
# provides should be versioned according to the ruby version.
8484
# More info: https://stdgems.org/
8585
Version: 3.1.4
86-
Release: 4%{?dist}
86+
Release: 5%{?dist}
8787
License: (Ruby OR BSD) AND Public Domain AND MIT AND CC0 AND zlib AND UCD
8888
Vendor: Microsoft Corporation
8989
Distribution: Mariner
@@ -101,6 +101,7 @@ Source7: macros.rubygems
101101
Patch0: CVE-2023-36617.patch
102102
Patch1: CVE-2024-27280.patch
103103
Patch2: CVE-2024-27281.patch
104+
Patch3: CVE-2024-27282.patch
104105
BuildRequires: openssl-devel
105106
BuildRequires: readline
106107
BuildRequires: readline-devel
@@ -403,6 +404,9 @@ sudo -u test make test TESTS="-v"
403404
%{_rpmconfigdir}/rubygems.con
404405

405406
%changelog
407+
* Thu May 16 2024 Jonathan Behrens <jbehrens@microsoft.com> - 3.1.4-5
408+
- Patch CVE-2024-27282
409+
406410
* Fri Apr 12 2024 Andrew Phelps <anphel@microsoft.com> - 3.1.4-4
407411
- Add patches for CVE-2024-27280 and CVE-2024-27281
408412

0 commit comments

Comments
 (0)