|
| 1 | +From b5c3a17c2c207ebefcb85043f0cf94be9b2fef81 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Octavian Guzu <octavguzu@fb.com> |
| 3 | +Date: Tue, 3 Oct 2023 18:48:08 +0000 |
| 4 | +Subject: [PATCH] [fuzzing result][fuzz_torch_jit_lite_interpreter] |
| 5 | + read-heap-buffer-overflow-far-from-bounds (size 4) in c10::IValue::IValue() |
| 6 | + (#110441) |
| 7 | + |
| 8 | +Summary: This diff fixes a heap underflow found by fuzzing in torch/csrc/jit/runtime/vararg_functions.cpp |
| 9 | + |
| 10 | +Test Plan: |
| 11 | +CI and |
| 12 | +``` |
| 13 | +arc lionhead crash reproduce 1753074381791061 |
| 14 | +``` |
| 15 | +doesn't crash anymore. |
| 16 | + |
| 17 | +Differential Revision: D49537535 |
| 18 | + |
| 19 | +Pull Request resolved: https://github.com/pytorch/pytorch/pull/110441 |
| 20 | +Approved by: https://github.com/Skylion007 |
| 21 | +--- |
| 22 | + torch/csrc/jit/runtime/vararg_functions.cpp | 3 +++ |
| 23 | + 1 file changed, 3 insertions(+) |
| 24 | + |
| 25 | +diff --git a/torch/csrc/jit/runtime/vararg_functions.cpp b/torch/csrc/jit/runtime/vararg_functions.cpp |
| 26 | +index 69e2c0fc1790603..bb28b61fe7e2c89 100644 |
| 27 | +--- a/torch/csrc/jit/runtime/vararg_functions.cpp |
| 28 | ++++ b/torch/csrc/jit/runtime/vararg_functions.cpp |
| 29 | +@@ -267,6 +267,9 @@ void listUnpack(Stack& stack, size_t num_outputs) { |
| 30 | + } |
| 31 | + |
| 32 | + void tupleConstruct(Stack& stack, size_t num_inputs) { |
| 33 | ++ if (num_inputs > stack.size()) { |
| 34 | ++ TORCH_CHECK(false, "Invalid number of inputs: ", num_inputs); |
| 35 | ++ } |
| 36 | + switch (num_inputs) { |
| 37 | + case 0: |
| 38 | + stack.emplace_back(c10::ivalue::Tuple::create()); |
0 commit comments