mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Merged revisions 84506 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84506 | antoine.pitrou | 2010-09-04 22:53:29 +0200 (sam., 04 sept. 2010) | 5 lines Issue #8734: Avoid crash in msvcrt.get_osfhandle() when an invalid file descriptor is provided. Patch by Pascal Chambon. ........
This commit is contained in:
		
							parent
							
								
									ec80478967
								
							
						
					
					
						commit
						0bb502dcac
					
				
					 3 changed files with 9 additions and 0 deletions
				
			
		|  | @ -313,6 +313,9 @@ def testBytesOpen(self): | ||||||
|     def testInvalidFd(self): |     def testInvalidFd(self): | ||||||
|         self.assertRaises(ValueError, _FileIO, -10) |         self.assertRaises(ValueError, _FileIO, -10) | ||||||
|         self.assertRaises(OSError, _FileIO, make_bad_fd()) |         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): |     def testBadModeArgument(self): | ||||||
|         # verify that we get a sensible error message for bad mode argument |         # verify that we get a sensible error message for bad mode argument | ||||||
|  |  | ||||||
|  | @ -477,6 +477,9 @@ Library | ||||||
| Extension Modules | Extension Modules | ||||||
| ----------------- | ----------------- | ||||||
| 
 | 
 | ||||||
|  | - 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() | - Issue #7736: Release the GIL around calls to opendir() and closedir() | ||||||
|   in the posix module.  Patch by Marcin Bachry. |   in the posix module.  Patch by Marcin Bachry. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -143,6 +143,9 @@ msvcrt_get_osfhandle(PyObject *self, PyObject *args) | ||||||
|     if (!PyArg_ParseTuple(args,"i:get_osfhandle", &fd)) |     if (!PyArg_ParseTuple(args,"i:get_osfhandle", &fd)) | ||||||
|         return NULL; |         return NULL; | ||||||
| 
 | 
 | ||||||
|  |     if (!_PyVerify_fd(fd)) | ||||||
|  |         return PyErr_SetFromErrno(PyExc_IOError); | ||||||
|  | 
 | ||||||
|     handle = _get_osfhandle(fd); |     handle = _get_osfhandle(fd); | ||||||
|     if (handle == -1) |     if (handle == -1) | ||||||
|         return PyErr_SetFromErrno(PyExc_IOError); |         return PyErr_SetFromErrno(PyExc_IOError); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Antoine Pitrou
						Antoine Pitrou