Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sax Parser Crashes on exceptions with process destroying on 1.1.3 #1

Closed
cthulhu opened this issue Jun 8, 2010 · 4 comments
Closed

Comments

@cthulhu
Copy link

cthulhu commented Jun 8, 2010

Sax Parser crashes on non valid xmls and destroys the running process

Platform - Ubuntu 9.04 Linux (32), Ruby MRI 1.8.7
Libxml-ruby ver 1.1.3

Code:

class SAXParserCallbacks
    include LibXML::XML::SaxParser::Callbacks
end
parser = LibXML::XML::SaxParser.io( data_io )
parser.callbacks = SAXParserCallbacks.new( {:header => header} )
parser.parse

I couldn't add that xml cos it breaks the markup

@cfis
Copy link
Owner

cfis commented Apr 17, 2011

The tc_sax_parser.rb file includes an example of invalid xml, but the process doesn't crash. Can you provide the xml you are trying to test?

Charlie

@cthulhu
Copy link
Author

cthulhu commented Apr 18, 2011

Added test to my fork
https://github.com/cthulhu/libxml-ruby/blob/master/test/tc_sax_parser.rb

output rake test:

*** glibc detected *** /usr/bin/ruby1.8: free(): invalid pointer: 0x0013e440 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x42a591]
/lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0x42bde8]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x42eecd]
/usr/lib/libxml2.so.2(xmlFreeParserCtxt+0xc8)[0x293cc8]
ext/libxml/libxml_ruby.so(+0x1b55d)[0x13555d]
/usr/lib/libruby1.8.so.1.8(+0x4bc0b)[0xc22c0b]
/usr/lib/libruby1.8.so.1.8(+0x4bc3a)[0xc22c3a]
/usr/lib/libruby1.8.so.1.8(rb_gc_finalize_deferred+0x2b)[0xc22cab]
/usr/lib/libruby1.8.so.1.8(rb_thread_schedule+0x35)[0xc11ed5]
/usr/lib/libruby1.8.so.1.8(+0x32ae5)[0xc09ae5]
/usr/lib/libruby1.8.so.1.8(+0x32c6e)[0xc09c6e]
/usr/lib/libruby1.8.so.1.8(+0x32c6e)[0xc09c6e]
/usr/lib/libruby1.8.so.1.8(+0x36b1b)[0xc0db1b]
/usr/lib/libruby1.8.so.1.8(rb_yield+0x27)[0xc19127]
/usr/lib/libruby1.8.so.1.8(+0x62171)[0xc39171]
/usr/lib/libruby1.8.so.1.8(+0x2c9ad)[0xc039ad]
/usr/lib/libruby1.8.so.1.8(+0x38151)[0xc0f151]
/usr/lib/libruby1.8.so.1.8(+0x382ea)[0xc0f2ea]
/usr/lib/libruby1.8.so.1.8(+0x3554b)[0xc0c54b]
/usr/lib/libruby1.8.so.1.8(+0x36003)[0xc0d003]
/usr/lib/libruby1.8.so.1.8(+0x36b1b)[0xc0db1b]
/usr/lib/libruby1.8.so.1.8(rb_yield+0x27)[0xc19127]
/usr/lib/libruby1.8.so.1.8(+0x62171)[0xc39171]
/usr/lib/libruby1.8.so.1.8(+0x2c9ad)[0xc039ad]
/usr/lib/libruby1.8.so.1.8(+0x38151)[0xc0f151]
/usr/lib/libruby1.8.so.1.8(+0x382ea)[0xc0f2ea]
/usr/lib/libruby1.8.so.1.8(+0x3554b)[0xc0c54b]
/usr/lib/libruby1.8.so.1.8(+0x36003)[0xc0d003]
/usr/lib/libruby1.8.so.1.8(+0x38001)[0xc0f001]
/usr/lib/libruby1.8.so.1.8(+0x382ea)[0xc0f2ea]
/usr/lib/libruby1.8.so.1.8(+0x38a1b)[0xc0fa1b]
/usr/lib/libruby1.8.so.1.8(+0x2c9c8)[0xc039c8]
/usr/lib/libruby1.8.so.1.8(+0x38151)[0xc0f151]
/usr/lib/libruby1.8.so.1.8(+0x382ea)[0xc0f2ea]
/usr/lib/libruby1.8.so.1.8(+0x3545c)[0xc0c45c]
/usr/lib/libruby1.8.so.1.8(+0x35a98)[0xc0ca98]
/usr/lib/libruby1.8.so.1.8(+0x35cbf)[0xc0ccbf]
/usr/lib/libruby1.8.so.1.8(+0x38001)[0xc0f001]
/usr/lib/libruby1.8.so.1.8(+0x382ea)[0xc0f2ea]
/usr/lib/libruby1.8.so.1.8(+0x3554b)[0xc0c54b]
/usr/lib/libruby1.8.so.1.8(+0x4282d)[0xc1982d]
/usr/lib/libruby1.8.so.1.8(+0x334cc)[0xc0a4cc]
/usr/lib/libruby1.8.so.1.8(+0x36b1b)[0xc0db1b]
/usr/lib/libruby1.8.so.1.8(rb_yield+0x27)[0xc19127]
/usr/lib/libruby1.8.so.1.8(rb_ary_each+0x41)[0xbea381]
/usr/lib/libruby1.8.so.1.8(+0x2c9ad)[0xc039ad]
/usr/lib/libruby1.8.so.1.8(+0x38151)[0xc0f151]
/usr/lib/libruby1.8.so.1.8(+0x382ea)[0xc0f2ea]
/usr/lib/libruby1.8.so.1.8(+0x3554b)[0xc0c54b]
/usr/lib/libruby1.8.so.1.8(+0x36003)[0xc0d003]
/usr/lib/libruby1.8.so.1.8(+0x38001)[0xc0f001]
/usr/lib/libruby1.8.so.1.8(+0x382ea)[0xc0f2ea]
/usr/lib/libruby1.8.so.1.8(+0x3554b)[0xc0c54b]
/usr/lib/libruby1.8.so.1.8(+0x4282d)[0xc1982d]
/usr/lib/libruby1.8.so.1.8(+0x334cc)[0xc0a4cc]
/usr/lib/libruby1.8.so.1.8(+0x36b1b)[0xc0db1b]
/usr/lib/libruby1.8.so.1.8(rb_yield+0x27)[0xc19127]
/usr/lib/libruby1.8.so.1.8(rb_ary_each+0x41)[0xbea381]
/usr/lib/libruby1.8.so.1.8(+0x2c9ad)[0xc039ad]
/usr/lib/libruby1.8.so.1.8(+0x38151)[0xc0f151]
/usr/lib/libruby1.8.so.1.8(+0x382ea)[0xc0f2ea]
/usr/lib/libruby1.8.so.1.8(+0x3554b)[0xc0c54b]
/usr/lib/libruby1.8.so.1.8(+0x36003)[0xc0d003]
======= Memory map: ========
00111000-00118000 r-xp 00000000 08:03 139444     /lib/tls/i686/cmov/librt-2.11.1.so
00118000-00119000 r--p 00006000 08:03 139444     /lib/tls/i686/cmov/librt-2.11.1.so
00119000-0011a000 rw-p 00007000 08:03 139444     /lib/tls/i686/cmov/librt-2.11.1.so
0011a000-0013d000 r-xp 00000000 08:03 2248027    /home/cthulhu/development/ruby/libxml-ruby/ext/libxml/libxml_ruby.so
0013d000-0013e000 r--p 00022000 08:03 2248027    /home/cthulhu/development/ruby/libxml-ruby/ext/libxml/libxml_ruby.so
0013e000-0013f000 rw-p 00023000 08:03 2248027    /home/cthulhu/development/ruby/libxml-ruby/ext/libxml/libxml_ruby.so
0013f000-00152000 r-xp 00000000 08:03 137731     /lib/tls/i686/cmov/libnsl-2.11.1.so
00152000-00153000 r--p 00012000 08:03 137731     /lib/tls/i686/cmov/libnsl-2.11.1.so
00153000-00154000 rw-p 00013000 08:03 137731     /lib/tls/i686/cmov/libnsl-2.11.1.so
00154000-00156000 rw-p 00000000 00:00 0
00156000-00158000 r-xp 00000000 08:03 4266       /usr/lib/ruby/1.8/i486-linux/etc.so
00158000-00159000 r--p 00001000 08:03 4266       /usr/lib/ruby/1.8/i486-linux/etc.so
00159000-0015a000 rw-p 00002000 08:03 4266       /usr/lib/ruby/1.8/i486-linux/etc.so
0015a000-00177000 r-xp 00000000 08:03 1772       /lib/libgcc_s.so.1
00177000-00178000 r--p 0001c000 08:03 1772       /lib/libgcc_s.so.1
00178000-00179000 rw-p 0001d000 08:03 1772       /lib/libgcc_s.so.1
0023c000-00245000 r-xp 00000000 08:03 137726     /lib/tls/i686/cmov/libcrypt-2.11.1.so
00245000-00246000 r--p 00008000 08:03 137726     /lib/tls/i686/cmov/libcrypt-2.11.1.so
00246000-00247000 rw-p 00009000 08:03 137726     /lib/tls/i686/cmov/libcrypt-2.11.1.so
00247000-0026e000 rw-p 00000000 00:00 0
0026e000-00392000 r-xp 00000000 08:03 11938      /usr/lib/libxml2.so.2.7.6
00392000-00393000 ---p 00124000 08:03 11938      /usr/lib/libxml2.so.2.7.6
00393000-00397000 r--p 00124000 08:03 11938      /usr/lib/libxml2.so.2.7.6
00397000-00398000 rw-p 00128000 08:03 11938      /usr/lib/libxml2.so.2.7.6
00398000-00399000 rw-p 00000000 00:00 0
00399000-003bd000 r-xp 00000000 08:03 137728     /lib/tls/i686/cmov/libm-2.11.1.so
003bd000-003be000 r--p 00023000 08:03 137728     /lib/tls/i686/cmov/libm-2.11.1.so
003be000-003bf000 rw-p 00024000 08:03 137728     /lib/tls/i686/cmov/libm-2.11.1.so
003bf000-00512000 r-xp 00000000 08:03 137713     /lib/tls/i686/cmov/libc-2.11.1.so
00512000-00513000 ---p 00153000 08:03 137713     /lib/tls/i686/cmov/libc-2.11.1.so
00513000-00515000 r--p 00153000 08:03 137713     /lib/tls/i686/cmov/libc-2.11.1.so
00515000-00516000 rw-p 00155000 08:03 137713     /lib/tls/i686/cmov/libc-2.11.1.so
00516000-00519000 rw-p 00000000 00:00 0
00566000-00581000 r-xp 00000000 08:03 768        /lib/ld-2.11.1.so
00581000-00582000 r--p 0001a000 08:03 768        /lib/ld-2.11.1.so
00582000-00583000 rw-p 0001b000 08:03 768        /lib/ld-2.11.1.so
005ab000-005ad000 r-xp 00000000 08:03 137727     /lib/tls/i686/cmov/libdl-2.11.1.so
005ad000-005ae000 r--p 00001000 08:03 137727     /lib/tls/i686/cmov/libdl-2.11.1.so
005ae000-005af000 rw-p 00002000 08:03 137727     /lib/tls/i686/cmov/libdl-2.11.1.so
00702000-00706000 r-xp 00000000 08:03 4275       /usr/lib/ruby/1.8/i486-linux/stringio.so
00706000-00707000 r--p 00003000 08:03 4275       /usr/lib/ruby/1.8/i486-linux/stringio.so
00707000-00708000 rw-p 00004000 08:03 4275       /usr/lib/ruby/1.8/i486-linux/stringio.so
007ba000-007bb000 r-xp 00000000 00:00 0          [vdso]
00a47000-00a5a000 r-xp 00000000 08:03 1737       /lib/libz.so.1.2.3.3
00a5a000-00a5b000 r--p 00012000 08:03 1737       /lib/libz.so.1.2.3.3
00a5b000-00a5c000 rw-p 00013000 08:03 1737       /lib/libz.so.1.2.3.3
00bd7000-00ca5000 r-xp 00000000 08:03 13505      /usr/lib/libruby1.8.so.1.8.7
00ca5000-00ca6000 ---p 000ce000 08:03 13505      /usr/lib/libruby1.8.so.1.8.7
00ca6000-00ca7000 r--p 000ce000 08:03 13505      /usr/lib/libruby1.8.so.1.8.7
00ca7000-00ca9000 rw-p 000cf000 08:03 13505      /usr/lib/libruby1.8.so.1.8.7
00ca9000-00cb9000 rw-p 00000000 00:00 0
00ea8000-00ebd000 r-xp 00000000 08:03 138543     /lib/tls/i686/cmov/libpthread-2.11.1.so
00ebd000-00ebe000 r--p 00014000 08:03 138543     /lib/tls/i686/cmov/libpthread-2.11.1.so
00ebe000-00ebf000 rw-p 00015000 08:03 138543     /lib/tls/i686/cmov/libpthread-2.11.1.so
00ebf000-00ec1000 rw-p 00000000 00:00 0
08048000-08049000 r-xp 00000000 08:03 8353       /usr/bin/ruby1.8
08049000-0804a000 r--p 00000000 08:03 8353       /usr/bin/ruby1.8
0804a000-0804b000 rw-p 00001000 08:03 8353       /usr/bin/ruby1.8
08453000-0a0fc000 rw-p 00000000 00:00 0          [heap]
b7300000-b7321000 rw-p 00000000 00:00 0
b7321000-b7400000 ---p 00000000 00:00 0
b74e1000-b773c000 rw-p 00000000 00:00 0
b773c000-b7745000 rw-p 00000000 00:00 0
b774f000-b7752000 rw-p 00000000 00:00 0
bfbbc000-bfbda000 rw-p 00000000 00:00 0          [stack]
Aborted
rake aborted!
Command failed with status (134): [/usr/bin/ruby1.8 -I"lib:test:lib:ext/libxm...]

uname -a
Linux test-laptop 2.6.32-24-generic xml4r#43-Ubuntu SMP Thu Sep 16 14:17:33 UTC 2010 i686 GNU/Linux

ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]

what env can be usefull as well?

@cfis
Copy link
Owner

cfis commented Apr 18, 2011

Thanks for the test. I just pushed it to https://github.com/xml4r/libxml-ruby, and it seems to pass without issue.

Can you try with libxml-ruby-2.0.2?

Also, note I've moved all my development over to the xml4r repository...

@cfis
Copy link
Owner

cfis commented Apr 23, 2011

This has been fixed - so closing this issue.

Thanks for the report.

@cfis cfis closed this as completed Apr 23, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants