[issue27570] Avoid memcpy(. . ., NULL, 0) etc calls

2016-09-08 Thread Martin Panter

Changes by Martin Panter :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27570] Avoid memcpy(. . ., NULL, 0) etc calls

2016-09-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d465da1e5902 by Martin Panter in branch '2.7':
Issue #27570: Avoid zero-length memcpy() calls with null source pointers
https://hg.python.org/cpython/rev/d465da1e5902

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27570] Avoid memcpy(. . ., NULL, 0) etc calls

2016-09-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e231dcad3a9b by Martin Panter in branch '3.5':
Issue #27570: Avoid zero-length memcpy() calls with null source pointers
https://hg.python.org/cpython/rev/e231dcad3a9b

New changeset 2d0fb659372c by Martin Panter in branch 'default':
Issue #27570: Merge null pointer fixes from 3.5
https://hg.python.org/cpython/rev/2d0fb659372c

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27570] Avoid memcpy(. . ., NULL, 0) etc calls

2016-09-06 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Sorry I missed this. The changes which I didn't already make look good. :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27570] Avoid memcpy(. . ., NULL, 0) etc calls

2016-09-06 Thread Martin Panter

Martin Panter added the comment:

Looks like revisions 5f3f6f1fb73a and ec537f9f468f may have fixed the 
listobject cases.

Also 66feda02f2a5 looks relevant. Benjamin, maybe you are interested in other 
bits of my patches :)

--
nosy: +benjamin.peterson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27570] Avoid memcpy(. . ., NULL, 0) etc calls

2016-08-02 Thread Martin Panter

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: . 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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27570] Avoid memcpy(. . ., NULL, 0) etc calls

2016-07-24 Thread Martin Panter

Martin Panter added the comment:

V2 patch adds another fix, uncovered by recent datetime tests:

>>> a = array("B")
>>> a[:] = a
/media/disk/home/proj/python/cpython/Modules/arraymodule.c:748:5: runtime 
error: null pointer passed as argument 1, which is declared to never be null
/media/disk/home/proj/python/cpython/Modules/arraymodule.c:748:5: runtime 
error: null pointer passed as argument 2, which is declared to never be null

--
Added file: http://bugs.python.org/file43852/memcpy-null.v2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27570] Avoid memcpy(. . ., NULL, 0) etc calls

2016-07-18 Thread Martin Panter

New submission from Martin Panter:

This patch fixes errors reported by GCC’s undefined behaviour sanitizer about 
calling functions with a null pointer:

./configure CC="gcc -fsanitize=undefined"

Using Issue 22605 as a precedent, I propose to avoid calling memcpy() and 
memmove() for zero-length copies when there may be a null pointer.

--
components: Interpreter Core, ctypes
files: memcpy-null.patch
keywords: patch
messages: 270806
nosy: martin.panter
priority: normal
severity: normal
stage: patch review
status: open
title: Avoid memcpy(. . ., NULL, 0) etc calls
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43784/memcpy-null.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com