aboutsummaryrefslogtreecommitdiff
path: root/lldb/unittests/ScriptInterpreter/Python
diff options
context:
space:
mode:
authorMed Ismail Bennani <medismail.bennani@gmail.com>2021-12-13 10:41:39 -0800
committerMed Ismail Bennani <medismail.bennani@gmail.com>2021-12-13 11:05:07 -0800
commitef74c8002ae86d95fd9d1927233102aac52d769c (patch)
treed81627108cf6d88c8b3e1ec2e4ea59b4c69e6669 /lldb/unittests/ScriptInterpreter/Python
parent72e25978f93f0bf7577593aba9591c727526423c (diff)
downloadllvm-ef74c8002ae86d95fd9d1927233102aac52d769c.zip
llvm-ef74c8002ae86d95fd9d1927233102aac52d769c.tar.gz
llvm-ef74c8002ae86d95fd9d1927233102aac52d769c.tar.bz2
[lldb/plugin] Fix heap-use-after-free in ScriptedProcess::ReadMemory
This commit should fix a heap-use-after-free bug that was caught by the sanitizer bot. The issue is that we were reading memory from a second target into a `SBData` object in Python, that was passed to lldb's internal `ScriptedProcess::DoReadMemory` C++ method. The ScriptedPythonInterface then extracts the underlying `DataExtractor` from the `SBData` object, and is used to read the memory with the appropriate address size and byte order. Unfortunately, it seems that even though the DataExtractor object was still valid, it pointed to invalid, possibly garbage-collected memory from Python. To mitigate this, the patch uses `SBData::SetDataWithOwnership` to copy the pointed buffer to lldb's heap memory which prevents the use-after-free error. rdar://84511405 Differential Revision: https://reviews.llvm.org/D115654 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/unittests/ScriptInterpreter/Python')
0 files changed, 0 insertions, 0 deletions