Bugs item #740417, was opened at 2003-05-20 12:31
Message generated for change (Comment added) made by shiyanovsky
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=740417&group_id=78018
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Max Shiyanovsky (shiyanovsky)
Assigned to: Nobody/Anonymous (nobody)
Summary: Potential error concealment in COM server initialization
Initial Comment:
file win32com\server\policy.py
class BasicWrapPolicy:
def _CreateInstance_(self, clsid, reqIID)
this function brings some danger in case of
win32api.error raise from server initialization routine.
I'd suggest to move except statement some rows above to
except only CLSID/PythonCom key reading failure.
----------------------------------------------------------------------
>Comment By: Max Shiyanovsky (shiyanovsky)
Date: 2003-05-30 16:01
Message:
Logged In: YES
user_id=782829
the whole code of _CreateInstance_ lookis like (doc-string
omitted)
def _CreateInstance_(self, clsid, reqIID):
try:
classSpec = win32api.RegQueryValue
(win32con.HKEY_CLASSES_ROOT,
regSpec % clsid)
myob = call_func(classSpec)
self._wrap_(myob)
return pythoncom.WrapObject(self, reqIID)
except win32api.error:
raise error, "The object is not correctly registered - %s
key can not be read" % (regSpec % clsid)
The call
myob = call_func(classSpec) may raise an exception and
furthermore exactly win32api.error. Certainly it's my bug that
don't handle such an exception in class ctor (in my case
callable object is a class). But as a result I've got a wrong
message "object is not correctly registered".
I suggest to wrap in try-except only win32api.RegQueryValue
call.
----------------------------------------------------------------------
Comment By: Mark Hammond (mhammond)
Date: 2003-05-27 02:01
Message:
Logged In: YES
user_id=14198
I don't quite follow this. Object creation should be in the
code:
if dispatcher:
retObj = dispatcher(policy, None)
else:
retObj = policy(None)
return retObj._CreateInstance_(clsid, reqIID)
And this is not wrapped in an except handler. I guess that
getting the dispatcher class could fail, but that seems alot
less likely than the class constructor failing.
Can you please give me a real example of what could fail?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=740417&group_id=78018
|