This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Invalid modes crash open()
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: splitscreen
Priority: normal Keywords:

Created on 2006-03-31 00:50 by splitscreen, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fileobject.diff splitscreen, 2006-03-31 00:50 rough patch
Messages (1)
msg27969 - (view) Author: Matt Fleming (splitscreen) Date: 2006-03-31 00:50
The 2.5a0 interpreter can be crashed by opening a file
with an invalid mode, i.e

open("bogus", "bogus")

results in the Microsoft Visual C++ Debug Library
spewing an "assertion failed" message with the expression

("Invalid file open mode", 0) 

in the file _open.c, line 98.

Attached is a very rough patch that raises and IOError
if the open mode doesn't begin with an 'a', 'w' or 'r'
on the Windows platform. 

If this is something wrong at my end (and I feel it may
be) please let me know. I'd be happy to offer any more
information.

BTW, I'm using Microsoft Visual Studio 2005.

Thanks,
Matt
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43115
2006-03-31 00:50:48splitscreencreate