You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Depending on timing, when read() is called and the remote end terminates its SSL connection cleanly, SSLZeroReturnError will be raised to the user and the final bytes of the stream are lost forever.
data = _safe_ssl_call(False, self._sock, 'recv', maxbufsize)
if not data:
break
In the above snippet, the second line will not execute when SSLZeroReturnError is raised. data is a local variable and its contents are lost.
There are identical code patterns which need fixing in _fileobject.readline() as well (maybe other places too, I'm not sure).
In the case size < 0, read() does not keep the contract of reading until EOF.
if size < 0:
# Read until EOF
self._rbuf = BytesIO() # reset _rbuf. we consume it via buf.
data = _safe_ssl_call(False, self._sock, 'recv', rbufsize)
buf.write(data)
return buf.getvalue()
In the above snippet, the comment is mistaken. There would have to be a loop for it to be true. No more than rbufsize additional bytes are read from the channel.
The text was updated successfully, but these errors were encountered:
There are several significant issues here:
Depending on timing, when read() is called and the remote end terminates its SSL connection cleanly, SSLZeroReturnError will be raised to the user and the final bytes of the stream are lost forever.
In the above snippet, the second line will not execute when SSLZeroReturnError is raised.
data
is a local variable and its contents are lost.There are identical code patterns which need fixing in _fileobject.readline() as well (maybe other places too, I'm not sure).
In the case size < 0, read() does not keep the contract of reading until EOF.
In the above snippet, the comment is mistaken. There would have to be a loop for it to be true. No more than rbufsize additional bytes are read from the channel.
The text was updated successfully, but these errors were encountered: