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
0049249d
Commit
0049249d
authored
Sep 04, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8734: Avoid crash in msvcrt.get_osfhandle() when an invalid file
descriptor is provided. Patch by Pascal Chambon.
parent
7d6e076f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
0 deletions
+9
-0
Lib/test/test_fileio.py
Lib/test/test_fileio.py
+3
-0
Misc/NEWS
Misc/NEWS
+3
-0
PC/msvcrtmodule.c
PC/msvcrtmodule.c
+3
-0
No files found.
Lib/test/test_fileio.py
View file @
0049249d
...
...
@@ -309,6 +309,9 @@ class OtherFileTests(unittest.TestCase):
def
testInvalidFd
(
self
):
self
.
assertRaises
(
ValueError
,
_FileIO
,
-
10
)
self
.
assertRaises
(
OSError
,
_FileIO
,
make_bad_fd
())
if
sys
.
platform
==
'win32'
:
import
msvcrt
self
.
assertRaises
(
IOError
,
msvcrt
.
get_osfhandle
,
make_bad_fd
())
def
testBadModeArgument
(
self
):
# verify that we get a sensible error message for bad mode argument
...
...
Misc/NEWS
View file @
0049249d
...
...
@@ -100,6 +100,9 @@ Core and Builtins
Extensions
----------
- Issue #8734: Avoid crash in msvcrt.get_osfhandle() when an invalid file
descriptor is provided. Patch by Pascal Chambon.
- Issue #7736: Release the GIL around calls to opendir() and closedir()
in the posix module. Patch by Marcin Bachry.
...
...
PC/msvcrtmodule.c
View file @
0049249d
...
...
@@ -143,6 +143,9 @@ msvcrt_get_osfhandle(PyObject *self, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"i:get_osfhandle"
,
&
fd
))
return
NULL
;
if
(
!
_PyVerify_fd
(
fd
))
return
PyErr_SetFromErrno
(
PyExc_IOError
);
handle
=
_get_osfhandle
(
fd
);
if
(
handle
==
-
1
)
return
PyErr_SetFromErrno
(
PyExc_IOError
);
...
...
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