classification
Title: ctypes crash when writing zerolength string buffer to file
Type: crash Stage: resolved
Components: ctypes Versions: Python 3.1, Python 3.2, Python 3.3, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Trundle, amaury.forgeotdarc, andbj, belopolsky, meador.inge, python-dev
Priority: normal Keywords: patch

Created on 2010-08-20 17:09 by andbj, last changed 2011-09-04 06:41 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
test.py andbj, 2010-08-20 17:09 create empty string buffer and write it to file
ctypes-buffer.patch amaury.forgeotdarc, 2010-08-21 13:19
Messages (8)
msg114430 - (view) Author: André Bjärby (andbj) Date: 2010-08-20 17:09
The attached (5 line) file will crash ctypes (Python 2.6.6rc2) with a "Floating point exception" (division by zero at _ctypes.c:2533).

There's no crash with python 2.5.5
msg114493 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-08-21 13:19
Confirmed on all versions since 2.6. Patch attached.
msg130295 - (view) Author: Andreas Stührk (Trundle) * Date: 2011-03-07 22:35
Looks good to me.
msg133915 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2011-04-17 00:45
This crash still occurs in the main development branch and Amaury's patch
still fixes the problem.  I verified that all tests pass on OS X 10.6.5.
It should be OK to commit.
msg142300 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2011-08-18 02:25
Ping.  I think this one is OK to commit.
msg143234 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-08-30 20:07
New changeset 5df1609fbd8f by Amaury Forgeot d'Arc in branch '3.2':
Issue #9651: Fix a crash when ctypes.create_string_buffer(0) was passed to
http://hg.python.org/cpython/rev/5df1609fbd8f

New changeset d8c73a7d65f8 by Amaury Forgeot d'Arc in branch 'default':
Merge from 3.2:
http://hg.python.org/cpython/rev/d8c73a7d65f8
msg143235 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-08-30 20:07
New changeset 4aa00f465b4f by Amaury Forgeot d'Arc in branch '2.7':
Issue #9651: Fix a crash when ctypes.create_string_buffer(0) was passed to
http://hg.python.org/cpython/rev/4aa00f465b4f
msg143482 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-09-04 06:41
New changeset f19d00b5220a by Amaury Forgeot d'Arc in branch '3.2':
Issue #9651: Fix a crash when ctypes.create_string_buffer(0) was passed to
http://hg.python.org/cpython/rev/f19d00b5220a
History
Date User Action Args
2011-09-04 06:41:59python-devsetmessages: + msg143482
2011-08-30 20:10:40amaury.forgeotdarcsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2011-08-30 20:07:47python-devsetmessages: + msg143235
2011-08-30 20:07:25python-devsetnosy: + python-dev
messages: + msg143234
2011-08-18 02:25:37meador.ingesetnosy: + belopolsky
messages: + msg142300
2011-04-17 00:45:54meador.ingesetassignee: theller ->
messages: + msg133915
nosy: + meador.inge, - theller
versions: + Python 3.1, Python 2.7, Python 3.2, Python 3.3
2011-03-07 22:35:34Trundlesetnosy: + Trundle
messages: + msg130295
2010-08-21 13:19:38amaury.forgeotdarcsetfiles: + ctypes-buffer.patch

nosy: + amaury.forgeotdarc
messages: + msg114493

keywords: + patch
stage: patch review
2010-08-20 17:09:59andbjcreate