Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/components/ruby-2.7.8.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
pkg.apply_patch "#{base}/regexp_use_after_free.patch"

pkg.apply_patch "#{base}/uri-redos-cve-2023-36617.patch"
pkg.apply_patch "#{base}/stringio_cve-2024-27280.patch"

if platform.is_cross_compiled?
unless platform.is_macos?
Expand Down
24 changes: 24 additions & 0 deletions resources/patches/ruby_27/stringio_cve-2024-27280.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Backport of:

From c58c5f54f1eab99665ea6a161d29ff6a7490afc8 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <[email protected]>
Date: Tue, 16 Nov 2021 17:39:32 +0900
Subject: [PATCH] [ruby/stringio] Fix expanding size at ungetc/ungetbyte

https://github.com/ruby/stringio/commit/a35268a3ac
---
ext/stringio/stringio.c | 2 +-
test/stringio/test_stringio.rb | 25 +++++++++++++++++++++----
2 files changed, 22 insertions(+), 5 deletions(-)

--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -983,7 +983,7 @@ strio_unget_bytes(struct StringIO *ptr,
len = RSTRING_LEN(str);
rest = pos - len;
if (cl > pos) {
- long ex = (rest < 0 ? cl-pos : cl+rest);
+ long ex = cl - (rest < 0 ? pos : len);
rb_str_modify_expand(str, ex);
rb_str_set_len(str, len + ex);
s = RSTRING_PTR(str);