0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-27 13:33:17 +08:00

42 Commits

Author SHA1 Message Date
Arseny Kapoulkine
4e004176ba tests: Improve out-of-memory tests
Previously there was no guarantee that the tests that check for out of memory
handling behavior are actually correct - e.g. that they correctly simulate out
of memory conditions.

Now every simulated out of memory condition has to be "guarded" using
CHECK_ALLOC_FAIL. It makes sure that every piece of code that is supposed to
cause out-of-memory does so, and that no other code runs out of memory
unnoticed.
2015-04-11 22:46:08 -07:00
Arseny Kapoulkine
29fef9aca2 tests: Add more out of memory tests
This provides more coverage for #17.
2015-04-11 00:16:39 -07:00
Arseny Kapoulkine
0542b1869b Fix buffer overrun when parsing comments inside DOCTYPE 2015-03-12 20:21:59 -07:00
Arseny Kapoulkine
12e137d12f tests: Move null buffer tests to test_document
Remove size=0 test since a better test is already there.
2015-03-05 11:46:34 -08:00
Arseny Kapoulkine
9749920c82 Refactor contents=0 behavior
Also change the error code to status_io_error
2015-03-05 11:35:39 -08:00
Arseny Kapoulkine
7ae7344256 Merge branch 'master' of https://github.com/mloy/pugixml into mloy-master 2015-03-05 10:09:54 -08:00
Arseny Kapoulkine
e9956ae3a6 Rename xml_document::load to load_string
This should completely eliminate the confusion between load and load_file.
Of course, for compatibility reasons we have to preserve the old variant -
it will be deprecated in a future version and subsequently removed.
2014-11-17 19:52:23 -08:00
mloy
837ced350c load_buffer_impl always checks if buffer is valid pointer and size > 0
added some tests to force invalid buffer and size = 0
2014-10-30 14:30:05 +01:00
Arseny Kapoulkine
903db8682a tests: Add more tests for better coverage
More tests for out-of-memory and other edge conditions

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1075 99668b35-9821-0410-8761-19e4c4f06640
2014-10-23 07:41:07 +00:00
Arseny Kapoulkine
bbd75fda46 tests: Improve test coverage
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1074 99668b35-9821-0410-8761-19e4c4f06640
2014-10-23 05:46:44 +00:00
Arseny Kapoulkine
3fcc530b34 tests: Add missing tests to increase code coverage
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1038 99668b35-9821-0410-8761-19e4c4f06640
2014-10-02 03:06:59 +00:00
Arseny Kapoulkine
5a4cedbe91 tests: Add tests for parse_trim_pcdata.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@988 99668b35-9821-0410-8761-19e4c4f06640
2014-02-25 03:41:57 +00:00
Arseny Kapoulkine
cbd8131d09 Fix clang build.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@986 99668b35-9821-0410-8761-19e4c4f06640
2014-02-23 19:38:24 +00:00
Arseny Kapoulkine
934bddcfa6 Fix gap collapsing during PCDATA parsing for fragment mode.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@985 99668b35-9821-0410-8761-19e4c4f06640
2014-02-23 19:28:27 +00:00
Arseny Kapoulkine
47c15ad949 Implement document fragment parsing.
Introduce a notable behavior change in default parsing mode: documents without a
document element node are now considered invalid. This is technically a breaking change,
however the amount of documents it affects is very small, all parsed data still persists,
and lack of this check results in very confusing behavior in a number of cases.

In order to be able to parse documents without an element node, a fragment parsing flag is
introduced.

Parsing a buffer in fragment mode treats the buffer as a fragment of a valid XML.
As a consequence, top-level PCDATA is added to the tree; additionally, there are no
restrictions on the number of nodes -- so documents without a document element are considered
valid.

Due to the way parsing works internally, load_buffer_inplace occasionally can not preserve
the document contents if it's parsed in a fragment mode. While unfortunate, this problem is
fundamental; since the use case is relatively obscure, hopefully documenting this shortcoming
will be enough.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@980 99668b35-9821-0410-8761-19e4c4f06640
2014-02-11 06:45:27 +00:00
Arseny Kapoulkine
79fb68ac41 Use a null-terminated buffer for parsing as often as possible.
Parsing used to work on a non null-terminated buffer, inserting a fake null terminator to increase performance.
This makes it impossible to implement fragment parsing that preserves PCDATA contents (as witnessed by some
tests for boundary conditions that actually depended on this behavior).

Since almost all uses result in us allocating an internal buffer anyway, the new policy is to make sure all buffers
that are allocated by pugixml are null-terminated - the only exception now is external calls to load_buffer_inplace
that don't trigger encoding conversion.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@977 99668b35-9821-0410-8761-19e4c4f06640
2014-02-10 16:57:04 +00:00
arseny.kapoulkine@gmail.com
fdc03d39ab tests: Fixed compilation errors for BadaSDK
git-svn-id: http://pugixml.googlecode.com/svn/trunk@839 99668b35-9821-0410-8761-19e4c4f06640
2012-03-06 06:13:10 +00:00
arseny.kapoulkine
1b87d3dcbf Introduced parse_ws_pcdata_single flag: only parses whitespace-only PCDATA if it's the only child of the parent node (middle ground between default flags and parse_ws_pcdata)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@825 99668b35-9821-0410-8761-19e4c4f06640
2011-12-09 05:24:07 +00:00
arseny.kapoulkine
7f3e74b543 tests: Improved tests for parsing result default construction
git-svn-id: http://pugixml.googlecode.com/svn/trunk@739 99668b35-9821-0410-8761-19e4c4f06640
2010-09-20 19:07:11 +00:00
arseny.kapoulkine
d35f6751cf tests: Added default ctor test
git-svn-id: http://pugixml.googlecode.com/svn/trunk@737 99668b35-9821-0410-8761-19e4c4f06640
2010-09-20 18:14:58 +00:00
arseny.kapoulkine
6df3609007 tests: Added even more tests for better code coverage
git-svn-id: http://pugixml.googlecode.com/svn/trunk@627 99668b35-9821-0410-8761-19e4c4f06640
2010-08-04 13:07:35 +00:00
arseny.kapoulkine
05c651d87f tests: Added more tests for better code coverage
git-svn-id: http://pugixml.googlecode.com/svn/trunk@626 99668b35-9821-0410-8761-19e4c4f06640
2010-08-04 10:01:16 +00:00
arseny.kapoulkine
085584aa30 tests: Preparations for custom new/delete (leak detection)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@620 99668b35-9821-0410-8761-19e4c4f06640
2010-08-03 08:03:23 +00:00
arseny.kapoulkine
7d24b9b565 Set svn:eol-style to native for all text files
git-svn-id: http://pugixml.googlecode.com/svn/trunk@607 99668b35-9821-0410-8761-19e4c4f06640
2010-07-19 09:57:32 +00:00
arseny.kapoulkine
8f27f244d0 parse_wnorm_attribute is no longer deprecated (it's part of W3C recommendations, after all)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@557 99668b35-9821-0410-8761-19e4c4f06640
2010-07-01 18:01:12 +00:00
arseny.kapoulkine
2b29b15573 tests: Added tests for parsing offset values
git-svn-id: http://pugixml.googlecode.com/svn/trunk@521 99668b35-9821-0410-8761-19e4c4f06640
2010-06-13 20:00:51 +00:00
arseny.kapoulkine
ab72b14d17 Internal XML parsing error handling is done via setjmp/longjmp, all allocation errors are now handled correctly (parser returns status_out_of_memory, modification functions return errors); added tests for some out of memory situations
git-svn-id: http://pugixml.googlecode.com/svn/trunk@520 99668b35-9821-0410-8761-19e4c4f06640
2010-06-13 19:24:20 +00:00
arseny.kapoulkine
1a007d66e6 tests: Added non top-level declaration test
git-svn-id: http://pugixml.googlecode.com/svn/trunk@516 99668b35-9821-0410-8761-19e4c4f06640
2010-06-12 07:35:08 +00:00
arseny.kapoulkine
f2050e5170 tests: Fixed PI test
git-svn-id: http://pugixml.googlecode.com/svn/trunk@514 99668b35-9821-0410-8761-19e4c4f06640
2010-06-11 22:04:23 +00:00
arseny.kapoulkine
12843b2f1b tests: Added more (failing) declaration/PI tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@513 99668b35-9821-0410-8761-19e4c4f06640
2010-06-11 21:44:28 +00:00
arseny.kapoulkine
624b5702d7 Rewritten numeric character reference parsing (fixed &#; and &#x; parsing), added more character reference tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@512 99668b35-9821-0410-8761-19e4c4f06640
2010-06-11 20:39:57 +00:00
arseny.kapoulkine
9fa82b15f5 Optimized attribute parsing; behavior of parse_wconv changed, it now assumes that parse_eol is set
git-svn-id: http://pugixml.googlecode.com/svn/trunk@503 99668b35-9821-0410-8761-19e4c4f06640
2010-06-04 18:50:26 +00:00
arseny.kapoulkine
8095117f54 tests: Minor addition to PI parsing tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@442 99668b35-9821-0410-8761-19e4c4f06640
2010-05-22 19:13:35 +00:00
arseny.kapoulkine
7bda2cb529 Implemented better DOCTYPE parsing, added more DOCTYPE tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@409 99668b35-9821-0410-8761-19e4c4f06640
2010-05-10 19:15:44 +00:00
arseny.kapoulkine
6706a3f8ba Deprecated all wildcard functions and parse_wnorm_attribute
git-svn-id: http://pugixml.googlecode.com/svn/trunk@389 99668b35-9821-0410-8761-19e4c4f06640
2010-05-08 20:30:29 +00:00
arseny.kapoulkine
f542c5ebb8 Integrated changes from unicode branch to trunk
git-svn-id: http://pugixml.googlecode.com/svn/trunk@383 99668b35-9821-0410-8761-19e4c4f06640
2010-05-06 20:28:36 +00:00
arseny.kapoulkine
cbdce99d5c tests: Added more escape error tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@169 99668b35-9821-0410-8761-19e4c4f06640
2009-10-21 08:52:27 +00:00
arseny.kapoulkine
a837271e9d tests: Added wildcard and doctype tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@163 99668b35-9821-0410-8761-19e4c4f06640
2009-10-20 20:51:20 +00:00
arseny.kapoulkine
c026597234 tests: Added more tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@162 99668b35-9821-0410-8761-19e4c4f06640
2009-10-20 20:25:35 +00:00
arseny.kapoulkine
dce82d3fb7 tests: More coverage
git-svn-id: http://pugixml.googlecode.com/svn/trunk@158 99668b35-9821-0410-8761-19e4c4f06640
2009-10-20 18:04:18 +00:00
arseny.kapoulkine
3d986d2b0d tests: Added declaration and document load/load_file error tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@157 99668b35-9821-0410-8761-19e4c4f06640
2009-10-20 17:49:52 +00:00
arseny.kapoulkine
a0990f0975 tests: Added parsing tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@156 99668b35-9821-0410-8761-19e4c4f06640
2009-10-20 17:41:08 +00:00