Closed GoogleCodeExporter closed 9 years ago
Please, provide the following additional information:
1. the original XML text (i.e. the string you pass to parse() function, before
you
call it since pugixml modifies it by inserting line terminators, etc.). File
attachment is preferred.
2. does it crash without valgrind?
Original comment by arseny.k...@gmail.com
on 15 Apr 2010 at 6:30
Is it possible that you're passing a string to parse() that's not
zero-terminated? If
you are, then this is a wrong usage - currently pugixml requires
zero-terminated
contents for parsing. It will append a zero to file contents automatically if
you're
using load_file or load(istream&) functions, but for parse() or load(const
char*)
you'll have to zero-terminate this yourself.
Original comment by arseny.k...@gmail.com
on 15 Apr 2010 at 6:32
Sorry, I've missed your answer.
The string was zero terminated as it's coming from the classic string library
(I'll
check again but I'm almost 99% sure about this)
The original text comes from Yahoo weather XML api.
It doesn't crash without valgrind (but at the same time, it's Valgrind expected
behaviour).
I think it reads off-by-one, and this crashes under valgrind because it put the
allocation on the end of an allocated page (so any access at size + 1 crash).
I'll try to save the original stream when this happens.
I'm using "valgrind --leak-check=full --track-origins=yes --db-attach=y
./software".
Original comment by xryl...@gmail.com
on 22 Apr 2010 at 4:48
I see. The tests for version of pugixml under development use a special
allocator
that aligns right end to the page end, and guards the next page; however the
parsing
code has changed somewhat from 0.5, so I can't be 100% sure there is no bug in
0.5.
All current tests also run fine under valgrind.
The location of the crash (the value of s) corresponds exactly to the symbol
(\270)
after \n in the last string; right where a zero terminator is expected.
Moreover, as
far as I understand, pugixml could not write here (since it can't read from
here!),
so this byte was originally \270, so I'm almost positive that the string is not
zero-
terminated for some reason.
Still, if you manage to save the original stream if the bug occurs again, I'll
be
more than happy to look into it.
Original comment by arseny.k...@gmail.com
on 22 Apr 2010 at 6:20
I'm closing the issue since there has been no confirmation of the bug. Feel
free to reopen it if you do have further problems.
Also note that in new version (0.9, which can be grabbed from "Downloads"
section) loading from memory is performed via new load_buffer functions, which
do not require a null-terminated string, but instead take buffer and size in
bytes. They are guaranteed to work as long as the given amount of bytes can be
read from the buffer.
Original comment by arseny.k...@gmail.com
on 11 Jul 2010 at 5:22
Original issue reported on code.google.com by
xryl...@gmail.com
on 15 Apr 2010 at 4:45