File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -510,6 +510,24 @@ def test_change_size_2(self):
510510 parser .Parse (xml2 , 1 )
511511 self .assertEquals (self .n , 4 )
512512
513+ class MalformedInputText (unittest .TestCase ):
514+ def test1 (self ):
515+ xml = "\0 \r \n "
516+ parser = expat .ParserCreate ()
517+ try :
518+ parser .Parse (xml , True )
519+ self .fail ()
520+ except expat .ExpatError as e :
521+ self .assertEquals (str (e ), 'no element found: line 2, column 1' )
522+
523+ def test2 (self ):
524+ xml = "<?xml version\xc2 \x85 ='1.0'?>\r \n "
525+ parser = expat .ParserCreate ()
526+ try :
527+ parser .Parse (xml , True )
528+ self .fail ()
529+ except expat .ExpatError as e :
530+ self .assertEquals (str (e ), 'XML declaration not well-formed: line 1, column 14' )
513531
514532def test_main ():
515533 run_unittest (SetAttributeTest ,
@@ -520,7 +538,8 @@ def test_main():
520538 HandlerExceptionTest ,
521539 PositionTest ,
522540 sf1296433Test ,
523- ChardataBufferTest )
541+ ChardataBufferTest ,
542+ MalformedInputText )
524543
525544if __name__ == "__main__" :
526545 test_main ()
Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ syntax error.
105105Extension Modules
106106-----------------
107107
108+ - Fix a segfault in expat.
109+
108110- Issue #4509: array.array objects are no longer modified after an operation
109111 failing due to the resize restriction in-place when the object has exported
110112 buffers.
Original file line number Diff line number Diff line change @@ -1741,7 +1741,7 @@ PREFIX(updatePosition)(const ENCODING *enc,
17411741 const char * end ,
17421742 POSITION * pos )
17431743{
1744- while (ptr != end ) {
1744+ while (ptr < end ) {
17451745 switch (BYTE_TYPE (enc , ptr )) {
17461746#define LEAD_CASE (n ) \
17471747 case BT_LEAD ## n: \
You can’t perform that action at this time.
0 commit comments