[issue15263] Guard against invalid file handles in os functions

2020-11-18 Thread Eryk Sun
Eryk Sun added the comment: > I don't see any _Py_VerifyFd in the code, is this out of date? Yes, this issue is out of date. The underlying issue is that the C runtime in Windows automatically checks various parameters and calls a registered handler for invalid parameters, for which the defa

[issue15263] Guard against invalid file handles in os functions

2020-11-18 Thread Irit Katriel
Irit Katriel added the comment: I don't see any _Py_VerifyFd in the code, is this out of date? -- nosy: +iritkatriel ___ Python tracker ___ ___

[issue15263] Guard against invalid file handles in os functions

2012-07-06 Thread Richard Oudkerk
Richard Oudkerk added the comment: Every use of _get_osfhandle() should be guarded by _Py_VerifyFd(). Grepping through the source it seems that that is now true, but we could instead use #define _PY_GET_OSFHANDLE(fd) _Py_VerifyFd(fd) ? _get_osfhandle(fd) : INVALID_HANDLE_VALUE -

[issue15263] Guard against invalid file handles in os functions

2012-07-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Antoine: all the functions enumerated in os.supports_fd. Note that the > set of such functions may in fact just be os.stat which is already fixed. As far as I can tell, it is: >>> os.supports_fd {} -- ___ Pytho

[issue15263] Guard against invalid file handles in os functions

2012-07-06 Thread Larry Hastings
Larry Hastings added the comment: Antoine: all the functions enumerated in os.supports_fd. Note that the set of such functions may in fact just be os.stat which is already fixed. Amaury: If you read the checkin that fixes this problem ( 62b9bfbc3356 ) it actually deliberately passes in INVAL

[issue15263] Guard against invalid file handles in os functions

2012-07-06 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Windows will also crash if you pass INVALID_HANDLE_VALUE (which is not a file descriptor) to crt functions... How did you want to use this macro? -- ___ Python tracker

[issue15263] Guard against invalid file handles in os functions

2012-07-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: Which other functions are you thinking about? -- nosy: +pitrou ___ Python tracker ___ ___ Python-bu

[issue15263] Guard against invalid file handles in os functions

2012-07-06 Thread Larry Hastings
New submission from Larry Hastings : #15261 shows us that Windows can crash if you pass in an invalid file handle to Windows POSIX-y functions. We should ensure that functions which accept path-as-an-int-fd guard against this where necessary. I propose a macro, something like #ifdef MS_WINDO