[pywin32-checkins] pywin32/com/win32com/src ErrorUtils.cpp,1.25,1.26
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2005-05-20 23:27:02
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26897 Modified Files: ErrorUtils.cpp Log Message: Clear all elements of the EXCEPINFO structure before filling it. This prevents garbage being seen by the callers of Python COM objects. Index: ErrorUtils.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/ErrorUtils.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ErrorUtils.cpp 28 Feb 2005 00:08:36 -0000 1.25 --- ErrorUtils.cpp 20 May 2005 23:26:53 -0000 1.26 *************** *** 18,22 **** LPCSTR GetFacilityString(SCODE sc); - static const EXCEPINFO nullExcepInfo = { 0 }; static PyObject *PyCom_PyObjectFromIErrorInfo(IErrorInfo *, HRESULT errorhr); --- 18,21 ---- *************** *** 42,46 **** } PyObject *exception, *v, *tb; - *pExcepInfo = nullExcepInfo; PyErr_Fetch(&exception, &v, &tb); if (PyCom_ExcepInfoFromPyObject(v, pExcepInfo, NULL)) --- 41,44 ---- *************** *** 50,53 **** --- 48,52 ---- else { + memset(pExcepInfo, 0, sizeof(EXCEPINFO)); // Clear the exception raised by PyCom_ExcepInfoFromPyObject, // not the one we are interested in! *************** *** 100,103 **** --- 99,103 ---- assert(v != NULL); assert(pExcepInfo != NULL); + memset(pExcepInfo, 0, sizeof(EXCEPINFO)); PyObject *ob = PyObject_GetAttrString(v, "description"); *************** *** 192,195 **** --- 192,196 ---- return FALSE; } + // It is a COM exception, but may be a server or client instance. // Explicit check for client. *************** *** 200,204 **** (PyInstance_Check(v) && // Class exceptions (PyObject *)(((PyInstanceObject *)v)->in_class)==PyWinExc_COMError) ) { ! // Client side error - use abstract API to get at details. PyObject *ob; if (phresult) { --- 201,208 ---- (PyInstance_Check(v) && // Class exceptions (PyObject *)(((PyInstanceObject *)v)->in_class)==PyWinExc_COMError) ) { ! // Client side error ! // Clear the state of the excep info. ! // use abstract API to get at details. ! memset(pExcepInfo, 0, sizeof(EXCEPINFO)); PyObject *ob; if (phresult) { |