[XML-SIG] Bug in exception handling?

Rob Hooft r.hooft@euromail.net
Wed, 23 Jun 1999 16:51:11 +0200 (MZT)


I really have no clue where to start looking for the following
problem:

not well-formed
Traceback (innermost last):
  File "/usr/local/nonius/app/scripts/comparehkl.py", line 459, in ?
    reflections.Source(file1).SendTo(ref1.Reflection)
  File "/usr/local/nonius/app/interface/evaly.py", line 79, in SendTo
    parser.parseFile(projtls.myopen(self.filename,'r'))
  File "/usr/local/nonius/lib/python1.5/site-packages/xml/sax/drivers/drv_pyexpat.py", line 73, in parseFile
    self.__report_error()
  File "/usr/local/nonius/lib/python1.5/site-packages/xml/sax/drivers/drv_pyexpat.py", line 89, in __report_error
    self.err_handler.fatalError(saxlib.SAXParseException(msg,None,self))
  File "/usr/local/nonius/app/interface/evaly.py", line 20, in fatalError
    raise exception
xml.sax.saxlib.SAXParseExceptionzsh: segmentation fault  comparehkl final.y

The routine that is causing this is:

    def fatalError(self, exception):
        print exception.msg
        raise exception
   
How does this crash the python interpreter?

xml.sax.saxlib.SAXParseException
Program received signal SIGSEGV, Segmentation fault.
normal_updatePosition (enc=0x4020414c, ptr=0x4020c01c <Address 0x4020c01c out of bounds>, 
    end=0x4020c180 <Address 0x4020c180 out of bounds>, pos=0x81b26d8) at xmltok/xmltok_impl.c:1618
1618        switch (BYTE_TYPE(enc, ptr)) {
(gdb) where
#0  normal_updatePosition (enc=0x4020414c, ptr=0x4020c01c <Address 0x4020c01c out of bounds>, 
    end=0x4020c180 <Address 0x4020c180 out of bounds>, pos=0x81b26d8) at xmltok/xmltok_impl.c:1618
#1  0x401f0ffd in XML_GetCurrentLineNumber (parser=0x81b2590) at xmlparse/xmlparse.c:642
#2  0x401f028c in xmlparse_getattr (self=0x81b2420, name=0x810cd44 "ErrorLineNumber") at ./pyexpat.c:349
#3  0x806d60b in PyObject_GetAttrString (v=0x81b2420, name=0x810cd44 "ErrorLineNumber") at object.c:381
#4  0x806d729 in PyObject_GetAttr (v=0x81b2420, name=0x810cd30) at object.c:438
#5  0x80742ce in eval_code2 (co=0x819e6c8, globals=0x810eae8, locals=0x0, args=0x81057d8, argcount=1, 
    kws=0x81057dc, kwcount=0, defs=0x0, defcount=0, owner=0x81afc38) at ceval.c:1380
#6  0x80748bd in eval_code2 (co=0x817a548, globals=0x8180060, locals=0x0, args=0x8176e8c, argcount=1, 
    kws=0x8176e90, kwcount=0, defs=0x0, defcount=0, owner=0x81805e8) at ceval.c:1610
#7  0x80748bd in eval_code2 (co=0x817ab18, globals=0x8180060, locals=0x0, args=0x810d784, argcount=1, 
    kws=0x0, kwcount=0, defs=0x0, defcount=0, owner=0x81805e8) at ceval.c:1610
#8  0x8075d60 in call_function (func=0x8180650, arg=0x810d778, kw=0x0) at ceval.c:2481
#9  0x8075942 in PyEval_CallObjectWithKeywords (func=0x816a298, arg=0x0, kw=0x0) at ceval.c:2319
#10 0x806d33e in PyObject_Str (v=0x810e668) at object.c:260
#11 0x805bab3 in PyErr_PrintEx (set_sys_last_vars=1) at pythonrun.c:816
#12 0x805b646 in PyErr_Print () at pythonrun.c:667
#13 0x805b3cc in PyRun_SimpleFile (fp=0x8098578, filename=0xbffff924 "scripts/comparehkl.py")
    at pythonrun.c:572
#14 0x805b061 in PyRun_AnyFile (fp=0x8098578, filename=0xbffff924 "scripts/comparehkl.py")
    at pythonrun.c:450
#15 0x804ef11 in Py_Main (argc=4, argv=0xbffff7fc) at main.c:286
#16 0x804e9b2 in main (argc=4, argv=0xbffff7fc) at python.c:12

The worst is: if I use only the first 4886 lines of the file, the "not
well-formed" error message correctly reports the problem in line 7,
column 37 of the file, but if I include 4887 or more, I get the above
core dump. The 4887 line file is 131053 bytes, just under 128kB?

Can I do something to fix this?

Regards,

Rob Hooft.

-- 
=====   R.Hooft@EuroMail.net   http://www.xs4all.nl/~hooft/rob/  =====
=====   R&D, Nonius BV, Delft  http://www.nonius.nl/             =====
===== PGPid 0xFA19277D ========================== Use Linux! =========