This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author FrancescElies
Recipients FrancescElies, paul.moore, steve.dower, tim.golden, zach.ware
Date 2021-11-19.12:06:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>

we are compiling a dll with clang and it's address sanitizer and loading it via cffi, at random spots ASAN complains with bad-free.

      ==15100==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x01991a850310 in thread T0
          #0 0x7ffa1dcc7f31  (C:\LLVM-13.0.0-win64\lib\clang\13.0.0\lib\windows\clang_rt.asan_dynamic-x86_64.dll+0x180037f31)
          #1 0x7ffa3aea59ec in _PyObject_Realloc D:\_w\1\s\Objects\obmalloc.c:2011
          #2 0x7ffa3af7f347 in _PyObject_GC_Resize D:\_w\1\s\Modules\gcmodule.c:2309
          #3 0x7ffa3aedeeaa in _PyEval_EvalCode D:\_w\1\s\Python\ceval.c:4101
          See links below for a full trace

The project where we see this it's quite complex and with many moving parts therefore we made a minimal reproducible example.


The test boils down to the following:

    import hello  # hello is our compiled c extension with clang and ASAN
    import pdb

If if comment the last line (import pdb) ASAN does not complain.
If instead of import pdb you import numpy the same problem can be seen.

See the following failing build
See here the CI test

We did not try this in linux yet, would that help?

Is this a bug? Or are we doing something wrong?

Thanks in advance for your time.
Date User Action Args
2021-11-19 12:06:17FrancescEliessetrecipients: + FrancescElies, paul.moore, tim.golden, zach.ware, steve.dower
2021-11-19 12:06:17FrancescEliessetmessageid: <>
2021-11-19 12:06:17FrancescElieslinkissue45842 messages
2021-11-19 12:06:17FrancescEliescreate