This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: expat causes a core dump
Type: Stage:
Components: XML Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: loewis Nosy List: fdrake, loewis, mmzeeman, nnorwitz, tim.peters
Priority: normal Keywords:

Created on 2002-10-29 14:37 by mmzeeman, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
expat_testje.py mmzeeman, 2002-10-29 14:37
Messages (6)
msg12987 - (view) Author: MM Zeeman (mmzeeman) Date: 2002-10-29 14:37
Raising an exception inside a StartNamespaceDeclHandler
causes
python to dump core. 

The attached program will cause a segmentation fault. 

Note it is possible to raise exception in the
StartElementHandler and
EndElementHandler

with Python 2.0
>python2.0 expat_testje.py
None 123
Segmentation fault (core dumped)

with Python 2.2.1
>python2 expat_testje.py
None 123
Segmentation fault (core dumped)

msg12988 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-10-29 22:14
Logged In: YES 
user_id=33168

This core dumps on 2.2.2 and 2.3.
msg12989 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-01-26 10:45
Logged In: YES 
user_id=21627

It appears to be fixed in 2.3, although I haven't
investigated which particular change has fixed it.
msg12990 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-07-15 19:15
Logged In: YES 
user_id=21627

I can't reproduce the crashes for 2.3, as of today. Can
anybody else confirm that the problem has gone away for 2.3?
msg12991 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2003-07-15 20:08
Logged In: YES 
user_id=31435

FYI, on Win2K the test program dies w/ a segfault under 2.2.3 
and under 2.3 CVS displays

None 123
Traceback (most recent call last):
  File "\code\expat_testje.py", line 19, in ?
    parser.Parse("""<tag xmlns="123">een twee drie</tag>""", 
1)
  File "\code\expat_testje.py", line 7, in 
handle_start_namespace
    raise Exception("Something is wrong here!")
Exception: Something is wrong here!
msg12992 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2003-07-15 20:25
Logged In: YES 
user_id=3066

I suspect this has to do with a change in Expat itself.  An
older version of Expat contained a problem which would cause
it to attempt to call a missing handler in some cases. 
Specifically, the exception in the namespace start handler
causes the Python binding to clear the handlers, at which
point Expat would attempt to call the start element handler
which had been replaced with a NULL pointer.  Expat wasn't
being careful about changes to the parser object caused by
Expat API calls; this was fixed in Expat 1.95.6.

Closing this as a third-party bug.  Python 2.3 includes a
sufficiently modern version of Expat.
History
Date User Action Args
2022-04-10 16:05:47adminsetgithub: 37381
2002-10-29 14:37:48mmzeemancreate