[ python-Bugs-951851 ] Crash when reading "import table" of certain windows DLLs

SourceForge.net noreply at sourceforge.net
Tue May 11 07:05:35 EDT 2004


Bugs item #951851, was opened at 2004-05-11 21:02
Message generated for change (Comment added) made by mhammond
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=951851&group_id=5470

Category: Windows
Group: Python 2.3
Status: Open
Resolution: None
Priority: 7
Submitted By: Mark Hammond (mhammond)
Assigned to: Thomas Heller (theller)
Summary: Crash when reading "import table" of certain windows DLLs

Initial Comment:
As diagnosed by Thomas Heller, via the python-win32 list.

On Windows 2000, if your sys.path includes the Windows
system32 directory, 'import wmi' will crash Python.  To
reproduce, change to the system32 directory, start
Python, and execute 'import wmi'.  Note that Windows XP
does not crash.

The problem is in GetPythonImport(), in code that tries
to walk the PE 'import table'.  AFAIK, this is code
that checks the correct Python version is used, but
I've never seen this code before.

I'm not sure why the code is actually crashing (ie,
what assumptions made about the import table are
wrong), but I have a patch that checks a the pointers
are valid before they are de-referenced.  After the
patch is applied, the result is the correct:
"ImportError: dynamic module does not define init
function (initwmi)"
exception.

Assigning to thomas for his review, then I'm happy to
check in.  I propose this as a 2.3 bugfix.

----------------------------------------------------------------------

>Comment By: Mark Hammond (mhammond)
Date: 2004-05-11 21:05

Message:
Logged In: YES 
user_id=14198

Actually, I guess a comment regarding the pointer checks and
referencing this bug would be nice :)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=951851&group_id=5470



More information about the Python-bugs-list mailing list