Update of /cvsroot/pywin32/pywin32/Pythonwin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21366
Modified Files:
win32notify.cpp
Log Message:
Prevent a crash if an OnNotify handler unexpectedly returns data
Index: win32notify.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32notify.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** win32notify.cpp 16 Feb 2008 08:25:44 -0000 1.4
--- win32notify.cpp 16 Feb 2008 23:39:57 -0000 1.5
***************
*** 132,135 ****
--- 132,140 ----
BOOL bIgnore;
int argNum = 0;
+ if (fmt==NULL){
+ PyErr_Format(PyExc_ValueError, "Notify code %d not expected to return data", ptr->code);
+ return;
+ }
+
while (*fmt) {
PyObject *ob = PyTuple_GetItem(args, argNum);
***************
*** 352,356 ****
// Result should be a tuple of the LRESULT and a tuple to fill the appropriate
// struct for this particular message
- // ??? What to do if fmt is still NULL at this point ???
if (PyArg_ParseTuple(result, "O&O", PyWinLong_AsVoidPtr, &rc, &obOther))
PyNotifyParseExtraTuple( pHdr, obOther, fmt);
--- 357,360 ----
|