[New-bugs-announce] [issue15046] Missing cast to Py_ssize_t in socket_connection.c

Marco den Otter report at bugs.python.org
Mon Jun 11 16:46:11 CEST 2012


New submission from Marco den Otter <marco.den.otter at nspyre.nl>:

In the file socket_connection.c on line 139 a cast to Py_ssize_t is missing for the return value.

Is:
  return res < 0 ? res : ulength;
Should be
  return res < 0 ? (Py_ssize_t)res : (Py_ssize_t)ulength;

Now it can be possible that a close of the socket is not detected.

Found the bug by creating a server client that only sends the length of a data package and then closing the socket. 

Without the cast the calling function (connection_recvbytes in connection.h) will try to return an object because of not detecting the result was smaller then 0.

----------
components: Library (Lib)
messages: 162620
nosy: MOtter
priority: normal
severity: normal
status: open
title: Missing cast to Py_ssize_t in socket_connection.c
type: behavior
versions: Python 2.7

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


More information about the New-bugs-announce mailing list