diff options
author | Daniil Kovalev <dkovalev@accesssoftek.com> | 2024-04-16 09:53:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-16 09:53:33 +0300 |
commit | 7e49b0d5a67f212e84f8ec0ec2e39a6a8673bfaf (patch) | |
tree | b03fa92bb0b8cba72ecffdefc24f6fb4be3d1199 /clang/lib/Serialization/GlobalModuleIndex.cpp | |
parent | 3c6f91e5b671321c95259dabecdbdfe4a6d69ce1 (diff) | |
download | llvm-7e49b0d5a67f212e84f8ec0ec2e39a6a8673bfaf.zip llvm-7e49b0d5a67f212e84f8ec0ec2e39a6a8673bfaf.tar.gz llvm-7e49b0d5a67f212e84f8ec0ec2e39a6a8673bfaf.tar.bz2 |
[lldb] Fix nullptr dereference on running x86 binary with x86-disabled llvm (#82603)
If `LLVM_TARGETS_TO_BUILD` does not contain `X86` and we try to run an
x86 binary in lldb, we get a `nullptr` dereference in
`LLVMDisasmInstruction(...)`. We try to call `getDisAsm()` method on a
`LLVMDisasmContext *DC` which is null. The pointer is passed from
`x86AssemblyInspectionEngine::instruction_length(...)` and is originally
`m_disasm_context` member of `x86AssemblyInspectionEngine`. This should
be filled by `LLVMCreateDisasm(...)` in the class constructor, but not
having X86 target enabled in llvm makes
`TargetRegistry::lookupTarget(...)` call return `nullptr`, which results
in `m_disasm_context` initialized with `nullptr` as well.
This patch adds if statements against `m_disasm_context` in
`x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly(...)`
and `x86AssemblyInspectionEngine::FindFirstNonPrologueInstruction(...)`
so subsequent calls to
`x86AssemblyInspectionEngine::instruction_length(...)` do not cause a
null pointer dereference.
Diffstat (limited to 'clang/lib/Serialization/GlobalModuleIndex.cpp')
0 files changed, 0 insertions, 0 deletions