Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Iñaki Úcar
b1a4e124f2 Security fix for CVE-2024-27322 2024-04-30 18:49:14 +02:00
2 changed files with 57 additions and 1 deletions

49
R-CVE-2024-27322.patch Normal file
View file

@ -0,0 +1,49 @@
From f7c46500f455eb4edfc3656c3fa20af61b16abb7 Mon Sep 17 00:00:00 2001
From: luke <luke@00db46b3-68df-0310-9c12-caf00c1e9a41>
Date: Sun, 31 Mar 2024 19:35:58 +0000
Subject: [PATCH] readRDS() and unserialize() now signal an errorr instead of
returning a PROMSXP.
git-svn-id: https://svn.r-project.org/R/trunk@86235 00db46b3-68df-0310-9c12-caf00c1e9a41
---
src/main/serialize.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/main/serialize.c b/src/main/serialize.c
index a389f713116..a190fbf8f3c 100644
--- a/src/main/serialize.c
+++ b/src/main/serialize.c
@@ -2650,6 +2650,13 @@ do_serializeToConn(SEXP call, SEXP op, SEXP args, SEXP env)
return R_NilValue;
}
+static SEXP checkNotPromise(SEXP val)
+{
+ if (TYPEOF(val) == PROMSXP)
+ error(_("cannot return a promise (PROMSXP) object"));
+ return val;
+}
+
/* unserializeFromConn(conn, hook) used from readRDS().
It became public in R 2.13.0, and that version added support for
connections internally */
@@ -2699,7 +2706,7 @@ do_unserializeFromConn(SEXP call, SEXP op, SEXP args, SEXP env)
con->close(con);
UNPROTECT(1);
}
- return ans;
+ return checkNotPromise(ans);
}
/*
@@ -3330,8 +3337,8 @@ attribute_hidden SEXP
do_serialize(SEXP call, SEXP op, SEXP args, SEXP env)
{
checkArity(op, args);
- if (PRIMVAL(op) == 2) return R_unserialize(CAR(args), CADR(args));
-
+ if (PRIMVAL(op) == 2) //return R_unserialize(CAR(args), CADR(args));
+ return checkNotPromise(R_unserialize(CAR(args), CADR(args)));
SEXP object, icon, type, ver, fun;
object = CAR(args); args = CDR(args);
icon = CAR(args); args = CDR(args);

9
R.spec
View file

@ -35,7 +35,7 @@
Name: R
Version: %{major_version}.%{minor_version}.%{patch_version}
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A language for data analysis and graphics
License: GPL-2.0-or-later
@ -43,6 +43,9 @@ URL: https://www.r-project.org
Source0: https://cran.r-project.org/src/base/R-4/R-%{version}.tar.gz
# see https://bugzilla.redhat.com/show_bug.cgi?id=1324145
Patch0: R-3.3.0-fix-java_path-in-javareconf.patch
# see https://bugzilla.redhat.com/show_bug.cgi?id=2277884
# https://github.com/r-devel/r-svn/commit/f7c46500f455eb4edfc3656c3fa20af61b16abb7
Patch1: R-CVE-2024-27322.patch
BuildRequires: gcc-gfortran
BuildRequires: gcc-c++
@ -303,6 +306,7 @@ from the R project. This package provides the static libRmath library.
%prep
%setup -q
%patch -P0 -p1 -b .fixpath
%patch -P1 -p1 -b .fixcve
%build
# Comment out default R_LIBS_SITE (since R 4.2) and set our own as always
@ -933,6 +937,9 @@ TZ="Europe/Paris" make check
%{_libdir}/libRmath.a
%changelog
* Tue Apr 30 2024 Iñaki Úcar <iucar@fedoraproject.org> - 4.3.3-2
- Security fix for CVE-2024-27322
* Thu Feb 29 2024 Iñaki Úcar <iucar@fedoraproject.org> - 4.3.3-1
- Update to 4.3.3