Skip to content

Commit a81d2af

Browse files
author
Johnny Chen
committed
Add fuzz calls for SBCompileUnit.
llvm-svn: 133843
1 parent 8766a83 commit a81d2af

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def test_SBCompileUnit(self):
9191
if self.TraceOn():
9292
print obj
9393
self.assertFalse(obj)
94+
# Do fuzz testing on the invalid obj, it should not crash lldb.
95+
import sb_compileunit
96+
sb_compileunit.fuzz_obj(obj)
9497

9598
@python_api_test
9699
def test_SBDebugger(self):
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Fuzz tests an object after the default construction to make sure it does not crash lldb.
3+
"""
4+
5+
import sys
6+
import lldb
7+
8+
def fuzz_obj(obj):
9+
obj.GetFileSpec()
10+
obj.GetNumLineEntries()
11+
obj.GetLineEntryAtIndex(0xffffffff)
12+
obj.FindLineEntryIndex(0, 0xffffffff, None)
13+
obj.GetDescription(lldb.SBStream())

0 commit comments

Comments
 (0)