[issue20251] socket.recvfrom_into crash with empty buffer

Vajrasky Kok report at bugs.python.org
Tue Jan 14 06:18:58 CET 2014


New submission from Vajrasky Kok:

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

----------
components: Extension Modules
files: recv_from_into_empty_byte_array.patch
keywords: patch
messages: 208073
nosy: benjamin.peterson, vajrasky
priority: normal
severity: normal
status: open
title: socket.recvfrom_into crash with empty buffer
type: crash
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33457/recv_from_into_empty_byte_array.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20251>
_______________________________________


More information about the Python-bugs-list mailing list