Skip to content

Commit 006662c

Browse files
Add {HW}ASan test
1 parent baba1c0 commit 006662c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎Lib/test/test_capi/test_mem.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,5 +182,18 @@ class PyMemDefaultTests(PyMemDebugTests):
182182
PYTHONMALLOC = ''
183183

184184

185+
@requires_subprocess()
186+
@unittest.skipUnless(support.check_sanitizer(address=True),
187+
'need address sanitizer')
188+
class AddressSanitizerTests(unittest.TestCase):
189+
def test_buffer_overflow(self):
190+
with support.SuppressCrashReport():
191+
out = assert_python_failure(
192+
'-c', 'import _testcapi; _testcapi.pymem_buffer_overflow()',
193+
PYTHONMALLOC='malloc',
194+
)
195+
self.assertIn(b'AddressSanitizer', out.err)
196+
197+
185198
if __name__ == "__main__":
186199
unittest.main()

0 commit comments

Comments
 (0)