Issue1238766

classification
Title: bug in xml parser
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: cgroves Nosy List: cgroves, l_heldt
Priority: low Keywords:

Created on 2005-07-15.08:53:18 by l_heldt, last changed 2006-08-31.03:48:46 by cgroves.

Messages
msg1002 (view) Author: Lukasz Heldt (l_heldt) Date: 2005-07-15.08:53:18
Jython xml parser has a bug in xmlutils.py file.

Function skip_ws(self, necessary=0) does not raise
OutOfDataException() in case when it does not reach end
of file but surpasses data index.

This causes parser error in situation where read buffer
(self.data) ends with following characters: '<nexttag '.

Parser raises error:

index out of range: 16416, traceback:
  File "shared/python/xmlSerializer.py", line 134, in
loadSuitIncarnationString
    xml.sax.parseString(strArg, handler)
  File "Lib/xml/sax/__init__.py", line 47, in parseString
    parser.parse(inpsrc)
  File "Lib/xml/sax/drivers2/drv_xmlproc.py", line 90,
in parse
    parser.read_from(source.getByteStream(), bufsize)
  File "Lib/xml/parsers/xmlproc/xmlutils.py", line 137,
in read_from
    self.feed(buf)
  File "Lib/xml/parsers/xmlproc/xmlutils.py", line 185,
in feed
    self.do_parse()
  File "Lib/xml/parsers/xmlproc/xmlproc.py", line 96,
in do_parse
    self.parse_start_tag()
  File "Lib/xml/parsers/xmlproc/xmlproc.py", line 149,
in parse_start_tag
    if self.data[self.pos]!=">" and
self.data[self.pos]!="/":

This is caused by skip_ws function not throwing
apropriate exception in case it reaches end of buffer.
It just finishes executing setting self.pos surpassing
self.datasize.

Another sollution to that problem is to check self.pos
in function parse_start_tag after calling skip_ws() but
this problem might affect other functions also.
msg1003 (view) Author: Charlie Groves (cgroves) Date: 2006-08-31.03:48:46
Logged In: YES 
user_id=1174327

Could you attach a simple py file that produces this error?
History
Date User Action Args
2005-07-15 08:53:18l_heldtcreate