Martin Panter added the comment:
Patch 3 fixes some more cases I found in the array module:
>>> a + a
Modules/arraymodule.c:809:5: runtime error: null pointer passed as argument 1,
which is declared to never be null
Modules/arraymodule.c:809:5: runtime error: null pointer passed as argument 2,
which is declared to never be null
Modules/arraymodule.c:810:5: runtime error: null pointer passed as argument 1,
which is declared to never be null
Modules/arraymodule.c:810:5: runtime error: null pointer passed as argument 2,
which is declared to never be null
array('B')
>>> a * 3
Modules/arraymodule.c:840:9: runtime error: null pointer passed as argument 1,
which is declared to never be null
Modules/arraymodule.c:840:9: runtime error: null pointer passed as argument 2,
which is declared to never be null
array('B')
>>> a += a
Modules/arraymodule.c:952:5: runtime error: null pointer passed as argument 1,
which is declared to never be null
Modules/arraymodule.c:952:5: runtime error: null pointer passed as argument 2,
which is declared to never be null
I wondered if there is a good argument for fixing these, or if it is only a
theoretical problem. Apparently GCC can do optimizations about null pointer
tests: <https://gcc.gnu.org/gcc-4.9/porting_to.html>. I don’t think any of the
cases I found are instances of this problem, but I think fixing them helps keep
the UB sanitizer output clean, so any errors causing practical behaviour
problems will be easier to find.
----------
Added file: http://bugs.python.org/file43987/memcpy-null.v3.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue27570>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com