Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cbd2e195
Commit
cbd2e195
authored
Mar 27, 2016
by
Martin Panter
Browse files
Options
Browse Files
Download
Plain Diff
Issue #26644: Merge SSL negative read fix from 3.5
parents
4fd8f7e8
d422ddb1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
Lib/test/test_ssl.py
Lib/test/test_ssl.py
+11
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_ssl.c
Modules/_ssl.c
+5
-0
No files found.
Lib/test/test_ssl.py
View file @
cbd2e195
...
...
@@ -2783,6 +2783,13 @@ if _have_threads:
# consume data
s
.
read
()
# read(-1, buffer) is supported, even though read(-1) is not
data
=
b"data"
s
.
send
(
data
)
buffer
=
bytearray
(
len
(
data
))
self
.
assertEqual
(
s
.
read
(
-
1
,
buffer
),
len
(
data
))
self
.
assertEqual
(
buffer
,
data
)
# Make sure sendmsg et al are disallowed to avoid
# inadvertent disclosure of data and/or corruption
# of the encrypted data stream
...
...
@@ -2792,6 +2799,10 @@ if _have_threads:
s
.
recvmsg_into
,
bytearray
(
100
))
s
.
write
(
b"over
\
n
"
)
self
.
assertRaises
(
ValueError
,
s
.
recv
,
-
1
)
self
.
assertRaises
(
ValueError
,
s
.
read
,
-
1
)
s
.
close
()
def
test_nonblocking_send
(
self
):
...
...
Misc/NEWS
View file @
cbd2e195
...
...
@@ -232,6 +232,9 @@ Core and Builtins
Library
-------
-
Issue
#
26644
:
Raise
ValueError
rather
than
SystemError
when
a
negative
length
is
passed
to
SSLSocket
.
recv
()
or
read
().
-
Issue
#
26616
:
Fixed
a
bug
in
datetime
.
astimezone
()
method
.
-
Issue
#
26637
:
The
:
mod
:`
importlib
`
module
now
emits
an
:
exc
:`
ImportError
`
...
...
Modules/_ssl.c
View file @
cbd2e195
...
...
@@ -1895,6 +1895,11 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1,
_PyTime_t
timeout
,
deadline
=
0
;
int
has_timeout
;
if
(
!
group_right_1
&&
len
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"size should not be negative"
);
return
NULL
;
}
if
(
sock
!=
NULL
)
{
if
(((
PyObject
*
)
sock
)
==
Py_None
)
{
_setSSLError
(
"Underlying socket connection gone"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment