[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-08-28 Thread Charles-François Natali
Charles-François Natali added the comment: Alright, committed to 2.7, 3.2 an default. Seems to work on all the buildbots, closing. -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-08-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset 852ca32eb18d by Charles-François Natali in branch '3.2': Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is http://hg.python.org/cpython/rev/852ca32eb18d New changeset ad1c09b6a5b9 by Charles-François Natali in branch 'defaul

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-08-28 Thread Charles-François Natali
Charles-François Natali added the comment: > STINNER Victor added the comment: > > The _socket module doesn't compile anymore on Windows: > Fixed (that's why I wanted a Windows expert to have a look at this patch :-). > You might replace "#if defined(_MSC_VER)" with "#if defined > (MS_WINDOWS

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-08-28 Thread STINNER Victor
STINNER Victor added the comment: The _socket module doesn't compile anymore on Windows: Build started: Project: _socket, Configuration: Debug|Win32 Compiling... socketmodule.c 29>..\Modules\socketmodule.c(1649) : warning C4013: '_PyIsSelectable_fd' undefined; assuming extern returning int Li

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-08-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset ff6adb867f40 by Charles-François Natali in branch '2.7': Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is http://hg.python.org/cpython/rev/ff6adb867f40 -- ___ Python tracker

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-08-24 Thread STINNER Victor
STINNER Victor added the comment: You might replace "#if defined(_MSC_VER)" with "#if defined(MS_WINDOWS)", but in another commit. -- ___ Python tracker ___ ___

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-08-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: > So, what should I do with is_selectable.diff? It looks ok to me. -- ___ Python tracker ___ ___ P

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-08-24 Thread Charles-François Natali
Charles-François Natali added the comment: So, what should I do with is_selectable.diff? -- ___ Python tracker ___ ___ Python-bugs-li

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-07-14 Thread Charles-François Natali
Charles-François Natali added the comment: Brian, any comment about the Windows part (see Victor's message, http://bugs.python.org/issue12287#msg138137) ? -- nosy: +brian.curtin ___ Python tracker ___

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset d0952a2fb7bd by Charles-François Natali in branch 'default': Issue #12287: In ossaudiodev, check that the device isn't closed in several http://hg.python.org/cpython/rev/d0952a2fb7bd -- nosy: +python-dev ___

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: > For oss_check_closed.diff, should I apply it to default only or to > every branch? Only default I'd say. -- ___ Python tracker ___ _

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-11 Thread Charles-François Natali
Charles-François Natali added the comment: For oss_check_closed.diff, should I apply it to default only or to every branch? -- ___ Python tracker ___ ___

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-10 Thread Charles-François Natali
Changes by Charles-François Natali : Removed file: http://bugs.python.org/file22325/oss_check_closed.diff ___ Python tracker ___ ___ Python-bu

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-10 Thread Charles-François Natali
Changes by Charles-François Natali : Removed file: http://bugs.python.org/file22324/is_selectable.diff ___ Python tracker ___ ___ Python-bugs-

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-10 Thread Charles-François Natali
Changes by Charles-François Natali : Added file: http://bugs.python.org/file22327/oss_check_closed.diff ___ Python tracker ___ ___ Python-bugs

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-10 Thread Charles-François Natali
Charles-François Natali added the comment: > In oss_check_closed.diff, you might want to add tests for the other > methods as well. I've added checks for other methods (not all of them, there are quite a few). I've also added a check for the mixer object. > You may add parenthesis around the

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-10 Thread STINNER Victor
STINNER Victor added the comment: Comments on is_selectable.diff. > +#define IS_SELECTABLE(s) (_PyIsSelectable_fd((s)->sock_fd) || > s->sock_timeout <= 0.0) You may add parenthesis around the second s (even if it's unrelated to this issue and not a regression of your patch). > +#ifdef Py_SO

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Two patches attached: > - a patch checking that the ossaudiodev object isn't closed > - a patch adding _PyIsSelectable_fd() In oss_check_closed.diff, you might want to add tests for the other methods as well. Otherwise, looks good! -- __

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-10 Thread Charles-François Natali
Changes by Charles-François Natali : Removed file: http://bugs.python.org/file22301/oss_check_closed.diff ___ Python tracker ___ ___ Python-bu

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-10 Thread Charles-François Natali
Changes by Charles-François Natali : Removed file: http://bugs.python.org/file22284/oss_select.diff ___ Python tracker ___ ___ Python-bugs-lis

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-10 Thread Charles-François Natali
Charles-François Natali added the comment: Two patches attached: - a patch checking that the ossaudiodev object isn't closed - a patch adding _PyIsSelectable_fd() -- Added file: http://bugs.python.org/file22324/is_selectable.diff Added file: http://bugs.python.org/file22325/oss_check_c

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-10 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: > I don't understand if socket file descriptors are different than > (classic) file descriptors. On Windows, sockets are completely independent from file descriptors. A socket id can be large (typically over 1000), fortunately a fd_set is not indexed by

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-09 Thread STINNER Victor
STINNER Victor added the comment: > So, this _PyCheckSelectable_fd ? function/macro would: > - return true (1) on Visual Studio or if > Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE is defined > - return false (0) if the file descriptor is greater than FD_SETSIZE otherwise > Do we agree on that? Py_SOCKET_

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-09 Thread Charles-François Natali
Charles-François Natali added the comment: > You don't check that 0 <= fd (e.g. oss.close()). > Actually, none of ossaudiodev's method does... This makes it even easier to trigger a segfault (at least on RHEL4): """ import ossaudiodev o = ossaudiodev.open('/dev/dsp', 'w') o.close() o.writeal

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-08 Thread STINNER Victor
STINNER Victor added the comment: You don't check that 0 <= fd (e.g. oss.close()). The select has a specific code for Visual Studio (don't check v < FD_SETSIZE): #if defined(_MSC_VER) max = 0; /* not used for Win32 */ #else /* !_MSC_VER */ if (v < 0

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: > ossaudiodev's writeall method doesn't check that the FD is less than > FD_SETSIZE when passing it to FD_SET: since FD_SET typically doesn't > do bound check, it will write to a random location in memory (in this > case on the stack). > I've attached a test tha

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-08 Thread Charles-François Natali
Changes by Charles-François Natali : Added file: http://bugs.python.org/file22285/test_oss.py ___ Python tracker ___ ___ Python-bugs-list mail

[issue12287] ossaudiodev: stack corruption with FD >= FD_SETSIZE

2011-06-08 Thread Charles-François Natali
New submission from Charles-François Natali : ossaudiodev's writeall method doesn't check that the FD is less than FD_SETSIZE when passing it to FD_SET: since FD_SET typically doesn't do bound check, it will write to a random location in memory (in this case on the stack). I've attached a test