Skip to content

Commit 1e20807

Browse files
pytorch: patch CVE-2024-31583
1 parent 458c5db commit 1e20807

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

SPECS/pytorch/CVE-2024-31583.patch

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From 9c7071b0e324f9fb68ab881283d6b8d388a4bcd2 Mon Sep 17 00:00:00 2001
2+
From: Octavian Guzu <octavian.guzu@gmail.com>
3+
Date: Fri, 29 Sep 2023 22:32:34 +0000
4+
Subject: [PATCH] [fuzzing result][fuzz_torch_jit_lite_interpreter]
5+
read-heap-use-after-free (size 8) in std::_Function_base::_M_empty()
6+
(#110289)
7+
8+
Summary: This diff fixes a heap UAF found by fuzzing in torch/csrc/jit/mobile/interpreter.cpp
9+
10+
Test Plan:
11+
CI and
12+
```
13+
arc lionhead crash reproduce 1009060456885023
14+
```
15+
doesn't crash anymore.
16+
17+
Reviewed By: malfet
18+
19+
Differential Revision: D49538326
20+
21+
Pull Request resolved: https://github.com/pytorch/pytorch/pull/110289
22+
Approved by: https://github.com/malfet
23+
---
24+
torch/csrc/jit/mobile/interpreter.cpp | 5 ++++-
25+
1 file changed, 4 insertions(+), 1 deletion(-)
26+
27+
diff --git a/torch/csrc/jit/mobile/interpreter.cpp b/torch/csrc/jit/mobile/interpreter.cpp
28+
index 9183c067f6599e8..6324ea9e3f03a18 100644
29+
--- a/torch/csrc/jit/mobile/interpreter.cpp
30+
+++ b/torch/csrc/jit/mobile/interpreter.cpp
31+
@@ -128,7 +128,10 @@ bool InterpreterState::run(Stack& stack) {
32+
mobile_debug_info->setOpIdx(pc);
33+
}
34+
}
35+
-
36+
+ if (inst.X < 0 ||
37+
+ static_cast<size_t>(inst.X) >= code.operators_.size()) {
38+
+ throw JITException("Invalid OP Instruction");
39+
+ }
40+
RECORD_EDGE_SCOPE_WITH_DEBUG_HANDLE_AND_INPUTS(
41+
code.op_names_[inst.X].name, debug_handle, stack);
42+
code.operators_[inst.X](stack);

SPECS/pytorch/pytorch.spec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Source0: https://github.com/pytorch/pytorch/releases/download/v%{version}
1212
# Use the generate_source_tarball.sh script to create a tarball of submodules during version updates.
1313
Source1: %{name}-%{version}-submodules.tar.gz
1414
Patch0: CVE-2024-31580.patch
15+
Patch1: CVE-2024-31583.patch
1516
BuildRequires: cmake
1617
BuildRequires: gcc
1718
BuildRequires: gcc-c++
@@ -84,7 +85,7 @@ cp -arf docs %{buildroot}/%{_pkgdocdir}
8485

8586
%changelog
8687
* Mon Apr 22 2024 Dan Streetman <ddstreet@microsoft.com> - 2.0.0-4
87-
- patch CVE-2024-31580
88+
- patch CVE-2024-31580, CVE-2024-31583
8889

8990
* Mon Dec 18 2023 Mandeep Plaha <mandeepplaha@microsoft.com> - 2.0.0-3
9091
- Set MAX_JOBS=8 to prevent build failure in ADO pipelines

0 commit comments

Comments
 (0)