test__POINTER_c_char (__main__.StringPtrTestCase) ... ok test__c_char_p (__main__.StringPtrTestCase) ... ok test_functions (__main__.StringPtrTestCase) ... ================================================================= ==7380==ERROR: AddressSanitizer: heap-use-after-free on address 0x60f00022bed2 at pc 0x55879bdeadde bp 0x7ffd729a2e70 sp 0x7ffd729a2e60 READ of size 1 at 0x60f00022bed2 thread T0 #0 0x55879bdeaddd in PyBytes_FromStringAndSize Objects/bytesobject.c:111 #1 0x7fd280452d70 in c_get /home/ben/python-source/cpython/Modules/_ctypes/cfield.c:1166 #2 0x7fd280442c7a in PyCData_get /home/ben/python-source/cpython/Modules/_ctypes/_ctypes.c:2953 #3 0x7fd2804438c7 in Pointer_item /home/ben/python-source/cpython/Modules/_ctypes/_ctypes.c:4971 #4 0x7fd280443a5f in Pointer_subscript /home/ben/python-source/cpython/Modules/_ctypes/_ctypes.c:5118 #5 0x55879c193cd1 in PyObject_GetItem Objects/abstract.c:154 #6 0x55879bf9c08e in _PyEval_EvalFrameDefault Python/ceval.c:1384 #7 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #8 0x55879be05eb1 in function_code_fastcall Objects/call.c:285 #9 0x55879be07b1b in _PyFunction_FastCallKeywords Objects/call.c:410 #10 0x55879bf915dc in call_function Python/ceval.c:4685 #11 0x55879bfb4400 in _PyEval_EvalFrameDefault Python/ceval.c:3258 #12 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #13 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #14 0x55879be06f4b in _PyFunction_FastCallDict Objects/call.c:378 #15 0x55879be0a728 in _PyObject_FastCallDict Objects/call.c:100 #16 0x55879be0ac6e in _PyObject_Call_Prepend Objects/call.c:906 #17 0x55879c1bca81 in method_call Objects/classobject.c:296 #18 0x55879be0cd40 in PyObject_Call Objects/call.c:247 #19 0x55879bf90240 in do_call_core Python/ceval.c:4739 #20 0x55879bfb4fa2 in _PyEval_EvalFrameDefault Python/ceval.c:3317 #21 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #22 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #23 0x55879be06f4b in _PyFunction_FastCallDict Objects/call.c:378 #24 0x55879be0a728 in _PyObject_FastCallDict Objects/call.c:100 #25 0x55879be0ac6e in _PyObject_Call_Prepend Objects/call.c:906 #26 0x55879bed6713 in slot_tp_call Objects/typeobject.c:6508 #27 0x55879be08a66 in _PyObject_FastCallKeywords Objects/call.c:201 #28 0x55879bf90c69 in call_function Python/ceval.c:4688 #29 0x55879bfb4400 in _PyEval_EvalFrameDefault Python/ceval.c:3258 #30 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #31 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #32 0x55879be06f4b in _PyFunction_FastCallDict Objects/call.c:378 #33 0x55879be0a728 in _PyObject_FastCallDict Objects/call.c:100 #34 0x55879be0ac6e in _PyObject_Call_Prepend Objects/call.c:906 #35 0x55879c1bca81 in method_call Objects/classobject.c:296 #36 0x55879be0cd40 in PyObject_Call Objects/call.c:247 #37 0x55879bf90240 in do_call_core Python/ceval.c:4739 #38 0x55879bfb4fa2 in _PyEval_EvalFrameDefault Python/ceval.c:3317 #39 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #40 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #41 0x55879be06f4b in _PyFunction_FastCallDict Objects/call.c:378 #42 0x55879be0a728 in _PyObject_FastCallDict Objects/call.c:100 #43 0x55879be0ac6e in _PyObject_Call_Prepend Objects/call.c:906 #44 0x55879bed6713 in slot_tp_call Objects/typeobject.c:6508 #45 0x55879be08a66 in _PyObject_FastCallKeywords Objects/call.c:201 #46 0x55879bf90c69 in call_function Python/ceval.c:4688 #47 0x55879bfb4400 in _PyEval_EvalFrameDefault Python/ceval.c:3258 #48 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #49 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #50 0x55879be06f4b in _PyFunction_FastCallDict Objects/call.c:378 #51 0x55879be0a728 in _PyObject_FastCallDict Objects/call.c:100 #52 0x55879be0ac6e in _PyObject_Call_Prepend Objects/call.c:906 #53 0x55879c1bca81 in method_call Objects/classobject.c:296 #54 0x55879be0cd40 in PyObject_Call Objects/call.c:247 #55 0x55879bf90240 in do_call_core Python/ceval.c:4739 #56 0x55879bfb4fa2 in _PyEval_EvalFrameDefault Python/ceval.c:3317 #57 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #58 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #59 0x55879be06f4b in _PyFunction_FastCallDict Objects/call.c:378 #60 0x55879be0a728 in _PyObject_FastCallDict Objects/call.c:100 #61 0x55879be0ac6e in _PyObject_Call_Prepend Objects/call.c:906 #62 0x55879bed6713 in slot_tp_call Objects/typeobject.c:6508 #63 0x55879be08a66 in _PyObject_FastCallKeywords Objects/call.c:201 #64 0x55879bf90c69 in call_function Python/ceval.c:4688 #65 0x55879bfb4400 in _PyEval_EvalFrameDefault Python/ceval.c:3258 #66 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #67 0x55879be05eb1 in function_code_fastcall Objects/call.c:285 #68 0x55879be07b1b in _PyFunction_FastCallKeywords Objects/call.c:410 #69 0x55879bf915dc in call_function Python/ceval.c:4685 #70 0x55879bfb3fc5 in _PyEval_EvalFrameDefault Python/ceval.c:3244 #71 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #72 0x55879be05eb1 in function_code_fastcall Objects/call.c:285 #73 0x55879be07b1b in _PyFunction_FastCallKeywords Objects/call.c:410 #74 0x55879bf915dc in call_function Python/ceval.c:4685 #75 0x55879bfb3fc5 in _PyEval_EvalFrameDefault Python/ceval.c:3244 #76 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #77 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #78 0x55879be06f4b in _PyFunction_FastCallDict Objects/call.c:378 #79 0x55879be0a728 in _PyObject_FastCallDict Objects/call.c:100 #80 0x55879be0ac6e in _PyObject_Call_Prepend Objects/call.c:906 #81 0x55879bed6343 in slot_tp_init Objects/typeobject.c:6742 #82 0x55879becede8 in type_call Objects/typeobject.c:960 #83 0x55879be08a66 in _PyObject_FastCallKeywords Objects/call.c:201 #84 0x55879bf90c69 in call_function Python/ceval.c:4688 #85 0x55879bfb4225 in _PyEval_EvalFrameDefault Python/ceval.c:3227 #86 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #87 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #88 0x55879bf94853 in PyEval_EvalCodeEx Python/ceval.c:4028 #89 0x55879bf94882 in PyEval_EvalCode Python/ceval.c:566 #90 0x55879c03fc3e in run_eval_code_obj Python/pythonrun.c:1046 #91 0x55879c04062b in run_mod Python/pythonrun.c:1062 #92 0x55879c0462c7 in PyRun_FileExFlags Python/pythonrun.c:993 #93 0x55879c04680d in PyRun_SimpleFileExFlags Python/pythonrun.c:428 #94 0x55879c046ade in PyRun_AnyFileExFlags Python/pythonrun.c:85 #95 0x55879bde2305 in pymain_run_file Modules/main.c:657 #96 0x55879bde3406 in pymain_run_python Modules/main.c:818 #97 0x55879bde61bc in pymain_main Modules/main.c:900 #98 0x55879bde6646 in _Py_UnixMain Modules/main.c:941 #99 0x55879bde091d in main Programs/python.c:16 #100 0x7fd284a3009a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #101 0x55879bde0859 in _start (/home/ben/python-source/cpython/python+0x1b7859) 0x60f00022bed2 is located 130 bytes inside of 176-byte region [0x60f00022be50,0x60f00022bf00) freed by thread T0 here: #0 0x7fd284e9cb70 in free (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedb70) #1 0x55879be98a99 in _PyMem_RawFree Objects/obmalloc.c:127 #2 0x55879be9989e in _PyMem_DebugRawFree Objects/obmalloc.c:2099 #3 0x55879be998d0 in _PyMem_DebugFree Objects/obmalloc.c:2220 #4 0x55879be9bb41 in PyObject_Free Objects/obmalloc.c:664 #5 0x55879c0878d9 in PyObject_GC_Del Modules/gcmodule.c:2005 #6 0x7fd280430321 in PyCData_dealloc /home/ben/python-source/cpython/Modules/_ctypes/_ctypes.c:2664 #7 0x55879bec931a in subtype_dealloc Objects/typeobject.c:1267 #8 0x55879be9268b in _Py_Dealloc Objects/object.c:2174 #9 0x55879bfa8ce7 in _Py_DECREF Include/object.h:470 #10 0x55879bfa8ce7 in _Py_XDECREF Include/object.h:533 #11 0x55879bfa8ce7 in _PyEval_EvalFrameDefault Python/ceval.c:2331 #12 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #13 0x55879be05eb1 in function_code_fastcall Objects/call.c:285 #14 0x55879be07b1b in _PyFunction_FastCallKeywords Objects/call.c:410 #15 0x55879bf915dc in call_function Python/ceval.c:4685 #16 0x55879bfb4400 in _PyEval_EvalFrameDefault Python/ceval.c:3258 #17 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #18 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #19 0x55879be06f4b in _PyFunction_FastCallDict Objects/call.c:378 #20 0x55879be0a728 in _PyObject_FastCallDict Objects/call.c:100 #21 0x55879be0ac6e in _PyObject_Call_Prepend Objects/call.c:906 #22 0x55879c1bca81 in method_call Objects/classobject.c:296 #23 0x55879be0cd40 in PyObject_Call Objects/call.c:247 #24 0x55879bf90240 in do_call_core Python/ceval.c:4739 #25 0x55879bfb4fa2 in _PyEval_EvalFrameDefault Python/ceval.c:3317 #26 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #27 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #28 0x55879be06f4b in _PyFunction_FastCallDict Objects/call.c:378 #29 0x55879be0a728 in _PyObject_FastCallDict Objects/call.c:100 #30 0x55879be0ac6e in _PyObject_Call_Prepend Objects/call.c:906 #31 0x55879bed6713 in slot_tp_call Objects/typeobject.c:6508 previously allocated by thread T0 here: #0 0x7fd284e9cf30 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30) #1 0x55879be98b05 in _PyMem_RawMalloc Objects/obmalloc.c:99 #2 0x55879be9979b in _PyMem_DebugRawAlloc Objects/obmalloc.c:2020 #3 0x55879be997f9 in _PyMem_DebugRawMalloc Objects/obmalloc.c:2049 #4 0x55879be99818 in _PyMem_DebugMalloc Objects/obmalloc.c:2205 #5 0x55879be9bac6 in PyObject_Malloc Objects/obmalloc.c:640 #6 0x55879c086145 in _PyObject_GC_Alloc Modules/gcmodule.c:1919 #7 0x55879c087516 in _PyObject_GC_Malloc Modules/gcmodule.c:1942 #8 0x55879bec3c17 in PyType_GenericAlloc Objects/typeobject.c:981 #9 0x7fd28043413b in GenericPyCData_new /home/ben/python-source/cpython/Modules/_ctypes/_ctypes.c:3108 #10 0x55879beced5d in type_call Objects/typeobject.c:940 #11 0x55879be08a66 in _PyObject_FastCallKeywords Objects/call.c:201 #12 0x55879bf90c69 in call_function Python/ceval.c:4688 #13 0x55879bfb4400 in _PyEval_EvalFrameDefault Python/ceval.c:3258 #14 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #15 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #16 0x55879be078fe in _PyFunction_FastCallKeywords Objects/call.c:435 #17 0x55879bf915dc in call_function Python/ceval.c:4685 #18 0x55879bfb4400 in _PyEval_EvalFrameDefault Python/ceval.c:3258 #19 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #20 0x55879bf9448f in _PyEval_EvalCodeWithName Python/ceval.c:3999 #21 0x55879be078fe in _PyFunction_FastCallKeywords Objects/call.c:435 #22 0x55879bf915dc in call_function Python/ceval.c:4685 #23 0x55879bfb4400 in _PyEval_EvalFrameDefault Python/ceval.c:3258 #24 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 #25 0x55879be05eb1 in function_code_fastcall Objects/call.c:285 #26 0x55879be07b1b in _PyFunction_FastCallKeywords Objects/call.c:410 #27 0x55879bf915dc in call_function Python/ceval.c:4685 #28 0x55879bfb4400 in _PyEval_EvalFrameDefault Python/ceval.c:3258 #29 0x55879bf92c83 in PyEval_EvalFrameEx Python/ceval.c:589 SUMMARY: AddressSanitizer: heap-use-after-free Objects/bytesobject.c:111 in PyBytes_FromStringAndSize Shadow bytes around the buggy address: 0x0c1e8003d780: fd fd fd fd fd fa fa fa fa fa fa fa fa fa fd fd 0x0c1e8003d790: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c1e8003d7a0: fd fd fd fd fa fa fa fa fa fa fa fa fd fd fd fd 0x0c1e8003d7b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c1e8003d7c0: fd fd fa fa fa fa fa fa fa fa fd fd fd fd fd fd =>0x0c1e8003d7d0: fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd fd fd 0x0c1e8003d7e0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c1e8003d7f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa 0x0c1e8003d800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e8003d810: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e8003d820: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==7380==ABORTING