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.

classification
Title: socket.recvfrom_into crash with empty buffer
Type: crash Stage: resolved
Components: Extension Modules Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, koobs, python-dev, vajrasky
Priority: normal Keywords: patch

Created on 2014-01-14 05:18 by vajrasky, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
recv_from_into_empty_byte_array.patch vajrasky, 2014-01-14 05:18 For Python 3.4 review
Messages (3)
msg208073 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2014-01-14 05:18
>>> import socket
>>> r, w = socket.socketpair()
>>> w.send(b'X' * 1024)
1024
>>> buffer = bytearray()
>>> r.recvfrom_into(buffer)
python: /home/sky/Code/python/cpython3.4/Modules/socketmodule.c:2867: sock_recvfrom_into: Assertion `buf != 0 && buflen > 0' failed.
Aborted (core dumped)

Attached the fix to handle the empty bytearray gracefully. The fix is for Python 3.4.
msg208074 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-14 05:22
New changeset 8712efe02dcc by Benjamin Peterson in branch '3.3':
remove overly strict assertion (closes #20251)
http://hg.python.org/cpython/rev/8712efe02dcc

New changeset ab9556830560 by Benjamin Peterson in branch 'default':
merge 3.3 (#20251)
http://hg.python.org/cpython/rev/ab9556830560
msg208075 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-14 05:29
New changeset 3881211cbb19 by Benjamin Peterson in branch '2.7':
remove overly strict assertion (closes #20251)
http://hg.python.org/cpython/rev/3881211cbb19

New changeset 1885e1768ff9 by Benjamin Peterson in branch '2.7':
add test for #20251
http://hg.python.org/cpython/rev/1885e1768ff9

New changeset 6ea64dcfb5e2 by Benjamin Peterson in branch '3.3':
add test for #20251
http://hg.python.org/cpython/rev/6ea64dcfb5e2
History
Date User Action Args
2022-04-11 14:57:56adminsetgithub: 64450
2014-03-04 09:38:28koobssetnosy: + koobs
2014-01-14 05:29:13python-devsetmessages: + msg208075
2014-01-14 05:22:58python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg208074

resolution: fixed
stage: resolved
2014-01-14 05:18:58vajraskycreate