diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-07-13 19:26:17 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-07-13 19:26:17 +0000 |
commit | e75e363cb71a7339552b9d943e78ac62b737379b (patch) | |
tree | 29ec5bd173694acbbcbb8207114ef7ca189436ba /unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp | |
parent | 1b306c26ade71504511d2fa75b03dfaee77f9620 (diff) |
Notes
Diffstat (limited to 'unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp')
-rw-r--r-- | unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp b/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp index e977609671970..c3591b2d73e1b 100644 --- a/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp +++ b/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp @@ -2415,3 +2415,28 @@ TEST_F(Testx86AssemblyInspectionEngine, TestStackRealign32BitDisp_x86_64) { EXPECT_EQ(rsp_plus_8, plan.GetRowForFunctionOffset(sizeof(data) - 1)->GetCFAValue()); } + +// Give the disassembler random bytes to test that it doesn't exceed +// the bounds of the array when run under clang's address sanitizer. +TEST_F(Testx86AssemblyInspectionEngine, TestDisassemblyJunkBytes) { + AddressRange sample_range; + UnwindPlan unwind_plan(eRegisterKindLLDB); + std::unique_ptr<x86AssemblyInspectionEngine> engine32 = Geti386Inspector(); + std::unique_ptr<x86AssemblyInspectionEngine> engine64 = Getx86_64Inspector(); + + uint8_t data[] = { + 0x10, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; + + sample_range = AddressRange(0x1000, sizeof(data)); + + EXPECT_TRUE(engine32->GetNonCallSiteUnwindPlanFromAssembly( + data, sizeof(data), sample_range, unwind_plan)); + + unwind_plan.Clear(); + + EXPECT_TRUE(engine64->GetNonCallSiteUnwindPlanFromAssembly( + data, sizeof(data), sample_range, unwind_plan)); + +} + |