Commit Graph

549 Commits

Author SHA1 Message Date
Rhodri James
4f9f6651b7 Test UTF-16 big-endian BOM vs explicit Latin-1 encoding 2017-07-22 22:49:18 +02:00
Rhodri James
afe76e8bbf Test UTF-16 BOM vs explicit latin-1 encoding parsing a full buffer 2017-07-22 22:49:18 +02:00
Rhodri James
8d6bb0fd1a Test UTF-16 BOM vs explicit latin-1 encoding 2017-07-22 22:49:18 +02:00
Rhodri James
a2104666fb Test specifying a UTF-16 encoding when creating the parser works 2017-07-22 22:49:18 +02:00
Rhodri James
5aa3ead193 Test unknown encoding with 17-bit top-bit-set character is rejected 2017-07-22 22:49:18 +02:00
Rhodri James
9bd8391e2c Test top-bit-set character mimicking surrogate high is rejected 2017-07-22 22:49:18 +02:00
Rhodri James
67aabeb2b8 Test top-bit set character mimicking ASCII is rejected in encodings 2017-07-22 22:49:18 +02:00
Rhodri James
a330a21859 Test unknown encoding with invalid multi-byte length field 2017-07-22 22:49:18 +02:00
Rhodri James
2ce358b203 More refactoring of unknown encoding handlers 2017-07-22 22:49:18 +02:00
Rhodri James
834eb92bdb Refactor to use encoding to switch UnknownEncoding handler behaviour 2017-07-22 22:49:17 +02:00
Rhodri James
36d8911ecb Test ASCII-like unknown encoding correctly rejects invalid characters 2017-07-22 22:49:17 +02:00
Rhodri James
0f950f4b9d Check that ASCII-like encoding is valid 2017-07-22 22:49:17 +02:00
Rhodri James
32ade2af40 Test unknown encoding not compatible with ASCII is rejected 2017-07-22 22:49:17 +02:00
Rhodri James
a88c4cff6d Test unknown encoding conversion buffer overflow not on convert() 2017-07-22 22:49:17 +02:00
Rhodri James
186945d238 Test unknown encoding conversion buffer overflow on convert() 2017-07-22 22:49:17 +02:00
Rhodri James
8c4249685f Test bad non-start of name in unknown encoding 2017-07-22 22:49:17 +02:00
Rhodri James
edc300c876 Test bad start of name with an unknown encoding 2017-07-22 22:49:17 +02:00
Rhodri James
e8999ace2e Test converted start of name with unknown encoding 2017-07-22 22:49:17 +02:00
Rhodri James
c0b7b55567 Test a valid (if odd) encoding 2017-07-22 22:49:17 +02:00
Rhodri James
19d0115623 Refactor to get rid of data/code pointer conversion warning 2017-07-22 22:49:17 +02:00
Rhodri James
b2ba9d7911 Add test for encoding conversion function returning errors 2017-07-22 22:49:17 +02:00
Rhodri James
63de667ed0 Add test of multi-byte encoding without a conversion function
At this commit, the tests seg fault
2017-07-22 22:49:17 +02:00
Rhodri James
69b864b9b1 Test XML declaration with missing value for 'standalone' attr 2017-07-22 22:49:17 +02:00
Rhodri James
5eafa10b6e Test XML declaration with missing attribute name 2017-07-22 22:49:17 +02:00
Rhodri James
b358d47719 Check invalid characters at the end of an XML declaration 2017-07-22 22:49:17 +02:00
Rhodri James
22bfe4f64d Extend test_utf16 to include a character encoded as 0xff?? 2017-07-22 22:49:17 +02:00
Rhodri James
9bb66e6699 Test that reversed UTF-16 surrogate pair in CDATA is rejected 2017-07-22 22:49:17 +02:00
Rhodri James
b99565c356 Test that a long attribute in ASCII encoding is correctly converted 2017-07-22 22:49:17 +02:00
Rhodri James
fddefa0680 Check latin1 char expanding to two bytes UTF-8 across a buffer boundary. 2017-07-22 22:49:16 +02:00
Rhodri James
a0ee59bd14 Test four-byte UTF-8 character are rejected in names 2017-07-22 22:49:16 +02:00
Rhodri James
1754bafba0 Test parsing element in namespace with a failing allocator 2017-07-22 22:49:16 +02:00
Rhodri James
704d03ef40 Test extremely long namespace prefix
Exercises a path in poolGrow that requires attempting to over-fill
a gap of more than 1024 characters in a non-empty pool.
2017-07-22 22:49:16 +02:00
Rhodri James
64f1b1b995 Test large element group with a failing allocator 2017-07-22 22:49:16 +02:00
Rhodri James
187650bad9 Test long notation value with external entity and failing allocator 2017-07-22 22:49:16 +02:00
Rhodri James
a40d23df08 Move external_entity_optioner up to be more generally available
No functionality changes in this commit
2017-07-22 22:49:16 +02:00
Rhodri James
eb99fe2529 Test long entity value and external entity with duff allocator 2017-07-22 22:49:16 +02:00
Rhodri James
fcae5d20aa Test external entity with long public ID and failing allocator 2017-07-22 22:49:16 +02:00
Rhodri James
1ce3d9049a Test long base URI for external parser with duff allocator 2017-07-22 22:49:16 +02:00
Rhodri James
75d3141f31 Test long entity system ID in external parser with failing allocator 2017-07-22 22:49:15 +02:00
Rhodri James
b03edfd961 Test with long default attribute for ext parser with duff allocator 2017-07-22 22:49:15 +02:00
Rhodri James
ec167d305c Test longer context URI with a failing reallocator 2017-07-22 22:49:15 +02:00
Rhodri James
6aecdba977 Test a long URI in the context string with a failing allocator 2017-07-22 22:49:15 +02:00
Rhodri James
4282072d9c Test long namespace in external entity context with duff reallocator 2017-07-22 22:49:15 +02:00
Rhodri James
4fe873c62b Test long general entity name in external DTD with failing realloc 2017-07-22 22:49:15 +02:00
Rhodri James
126c0e8459 Test shorter long context URI with a failing reallocator
One last code path to exercise
2017-07-22 22:49:15 +02:00
Rhodri James
2950c7ac09 Again test long context URI against a failing reallocator
Another different code path
2017-07-22 22:49:15 +02:00
Rhodri James
67f238b794 Refactor context URI reallocation tests 2017-07-22 22:49:15 +02:00
Rhodri James
ae9fe3c614 Test shorter context URI in the face of a failing reallocator
Yet another different code path exercised
2017-07-22 22:49:15 +02:00
Rhodri James
1136aceaa3 Test different length context URI with duff reallocator
Exercises another different code path
2017-07-22 22:49:15 +02:00
Rhodri James
f4e09d7d5d Test slightly shorter context URI with duff allocator
Exercises a different code path to previous context test
2017-07-22 22:49:15 +02:00
Rhodri James
464aefaccc Test appropriately long context URI with a failing reallocator 2017-07-22 22:49:15 +02:00
Rhodri James
90f5d5e833 Test not-so-long namespace with failing allocator 2017-07-22 22:49:15 +02:00
Rhodri James
ddd6a15043 Test long namespace with failing allocator 2017-07-22 22:49:15 +02:00
Rhodri James
02a9d765d6 Test long root element name with a failing allocator 2017-07-22 22:49:15 +02:00
Rhodri James
96afb81e9a Test longer namespace prefix with failing reallocator 2017-07-22 22:49:15 +02:00
Rhodri James
a5e1e0b94b Test long namespace prefix with a failing reallocator 2017-07-22 22:49:15 +02:00
Rhodri James
e64102e71e Test handling long attribute list with a failing reallocator 2017-07-22 22:49:15 +02:00
Rhodri James
aa04847906 Test that comments reach the default handler 2017-07-22 22:49:15 +02:00
Rhodri James
a7b6aea376 Test processing instruction with long body and duff allocator 2017-07-22 22:49:15 +02:00
Rhodri James
0a3a399d45 Test processing instruction reaches default handler if no PI handler 2017-07-22 22:49:15 +02:00
Rhodri James
5e4a2d6e6c Test char entity extending param entity with failing reallocator 2017-07-22 22:49:14 +02:00
Rhodri James
afe4ad3830 Silence overly-pessimistic compiler warning.
The parsed_version structure will be fully filled in if parse_version
returns a non-zero value, but initializing the variable to zero is a
trivial cost for the tests.
2017-07-22 22:49:14 +02:00
Rhodri James
5d75b0ae62 Test invalid character reference is faulted 2017-07-22 22:49:14 +02:00
Rhodri James
4792f7af1c Test expanding a param entity's string pool with a failing allocator 2017-07-22 22:49:14 +02:00
Rhodri James
87967e3623 Test trailing CR in a PE value is interpreted as a newline 2017-07-22 22:49:14 +02:00
Rhodri James
065ade6080 Test error in nested external entity substitution 2017-07-22 22:49:14 +02:00
Rhodri James
cb4f7250ac Test another different code path for skipped external entity 2017-07-22 22:49:14 +02:00
Rhodri James
49a38e6291 Test different code path for skipping missing external entity 2017-07-22 22:49:14 +02:00
Rhodri James
09aef7e7e3 Test recursive parameter entity 2017-07-22 22:49:14 +02:00
Rhodri James
b641ecffa1 Test missing external entity is skipped 2017-07-22 22:49:14 +02:00
Rhodri James
74a7cdc0ae Test general entity substitution in standalone internal param entity 2017-07-22 22:49:14 +02:00
Rhodri James
2ad7887d85 Test attribute value of a predefined entity with a duff allocator 2017-07-22 22:49:14 +02:00
Rhodri James
ee46bf0b44 Test whitespace attribute value with dodgy allocator 2017-07-22 22:49:14 +02:00
Rhodri James
a84705afc2 Test attribute value with trailing CR 2017-07-22 22:49:14 +02:00
Rhodri James
52e0daa410 Test long attribute value with failing allocator 2017-07-22 22:49:14 +02:00
Rhodri James
18106f4d58 Test long attribute value with character ref and a failing allocator
Tests strictly that a character reference at the end of a long default
value for an attribute will trigger the relevant string pool to grow,
and will recover correctly if there is no memory for growth
2017-07-22 22:49:14 +02:00
Rhodri James
8b5902c886 Test incomplete param ref in attribute default is rejected 2017-07-22 22:49:14 +02:00
Rhodri James
667d9cab63 Test invalid character in default attribute is rejected 2017-07-22 22:49:14 +02:00
Rhodri James
02dfd4b377 Test long attribute with a dodgy reallocator
This tests a specific code path through parameter substitution, and
requires the attribute value to come out to 1024 bytes PLUS a terminal
NUL to trigger growth of the string pool in use.  The NUL is added
separately, and it is that string append that we are triggering on.
2017-07-22 22:49:14 +02:00
Rhodri James
bf27884912 Test restarting an errored parser returns the same error 2017-07-22 22:49:14 +02:00
Rhodri James
4b9056ae17 Check that resumed general entity parse can be re-suspended 2017-07-22 22:49:14 +02:00
Rhodri James
aae811152f Test resuming a general entity catches XML errors 2017-07-22 22:49:14 +02:00
Rhodri James
28e9820bcd Test suspending and resuming parse in parameter entity substitution 2017-07-22 22:49:14 +02:00
Rhodri James
f9c01d3bae Test suspending and resuming parse during entity substitution 2017-07-22 22:49:14 +02:00
Rhodri James
9edf18d4ef Add test to ensure a hash collision while expanding hash table
This is purely an exercise in code coverage; there is no user-level
way of telling that the hash table has been expanded or that a
collision occurred.
2017-07-22 22:49:14 +02:00
Rhodri James
440df48dc3 Test suspending parse during epilog 2017-07-22 22:49:13 +02:00
Rhodri James
9528e62a1e Test aborting in the epilog not from a CR character 2017-07-22 22:49:13 +02:00
Rhodri James
ecfd3f15ad Test handling of partial characters at the end of the epilog 2017-07-22 22:49:13 +02:00
Rhodri James
4bec1abfd4 Test incomplete token in epilog 2017-07-22 22:49:13 +02:00
Rhodri James
1cab6d80f5 Test comment in epilog with failing allocator 2017-07-22 21:57:20 +02:00
Rhodri James
208d652559 Test PI handling in epilog with a failing allocator 2017-07-22 21:57:20 +02:00
Rhodri James
8a8c871723 Extend abort test to cover more epilog code 2017-07-22 21:57:20 +02:00
Rhodri James
eefb733dc7 Test aborting parse during epilog processing 2017-07-22 21:57:20 +02:00
Rhodri James
e8d8c84e3e Test suspending parse during an XML declaration 2017-07-22 21:57:20 +02:00
Rhodri James
6b2ead89fb Shuffle code to keep similar things together.
No functional changes
2017-07-22 21:56:11 +02:00
Rhodri James
b690ac32c1 Test group with many elements and a failing reallocator 2017-07-22 21:52:47 +02:00
Rhodri James
46c39a18c1 Test deeply nested group parsing with a failing allocator 2017-07-22 21:52:47 +02:00
Rhodri James
1ca9975b91 Add test for external parameter entity with "not standalone" handler 2017-07-22 21:52:47 +02:00
Rhodri James
6e63cc24bd Test external param entity with no further external parser 2017-07-22 21:52:47 +02:00
Rhodri James
79d190acef Test undefined system parameter entity in external DTD 2017-07-22 21:52:46 +02:00
Rhodri James
b76c65d111 Test recursive parameter entity is rejected 2017-07-22 21:52:46 +02:00
Rhodri James
80552b5c60 Test skipped parameter entity in external DTD triggers handler 2017-07-22 21:52:46 +02:00
Rhodri James
ff15a49746 Review 2017-03-13: refactor XML_Expat_Version test
Also revised to allow for the different definitions of XML_LChar.
Previous versions will not have worked in XML_UNICODE builds.
2017-07-22 21:52:16 +02:00
Rhodri James
78a68b76e3 Review 2017-03-13: construct test string to avoid magic numbers 2017-07-22 21:50:58 +02:00
Rhodri James
d697e27038 Review 2017-03-13: replace magic number with appropriate string len 2017-07-22 21:50:57 +02:00
Rhodri James
be42a4ae1f Remove warning about potentially unset variable in tests
Also make test function external_entity_public() more robust
against misuse.
2017-07-22 21:48:17 +02:00
Rhodri James
1d086b2915 Test standalone parameter entity coverage 2017-07-22 21:46:17 +02:00
Rhodri James
1adb2438d0 Test substituted public entity with long name against failing realloc 2017-07-22 21:46:17 +02:00
Rhodri James
3c526f6d6c Test group with choice in element declaration 2017-07-22 21:46:17 +02:00
Rhodri James
da5c188913 Add element decl handler to nested group reallocation test 2017-07-22 21:46:17 +02:00
Rhodri James
260a7644d7 Add element declaration handler to nested group test 2017-07-22 21:46:17 +02:00
Rhodri James
1bb33c7027 Test nested groups with a failing reallocator 2017-07-22 21:46:16 +02:00
Rhodri James
507c2e5c9b Test deeply-nested groups 2017-07-22 21:46:16 +02:00
Rhodri James
383e762f8c Test public notation with no system ID 2017-07-22 21:46:16 +02:00
Rhodri James
d4bc5da92b Test system notation with failing allocator 2017-07-22 21:46:16 +02:00
Rhodri James
6ae8e2777e Test public notation with long system ID against failing allocator 2017-07-22 21:46:16 +02:00
Rhodri James
1044af1f31 Extend notation allocation test with notation declaration handler
This extends the code coverage a little, in particular checking
another allocation failure path.
2017-07-22 21:46:16 +02:00
Rhodri James
5a1f46a87d Extend PE allocation test with long entity name 2017-07-22 21:46:16 +02:00
Rhodri James
cc6edd8913 Test DTD processing stops for undefined parameter entities 2017-07-22 21:46:16 +02:00
Rhodri James
4608ff10be Test redefining predefined entities 2017-07-22 21:46:16 +02:00
Rhodri James
b30bd12020 Add entity decl handler to notation entity allocation test 2017-07-22 21:46:16 +02:00
Rhodri James
775e63708d Test notation entity with failing allocator 2017-07-22 21:46:16 +02:00
Rhodri James
71e8442db9 Extend NotStandalone tests to also exclude external entity handlers 2017-07-22 21:46:16 +02:00
Rhodri James
fab38d3fc0 Test public doctype with long public name against failing allocator 2017-07-22 21:46:16 +02:00
Rhodri James
ee957bb60a Test attribute with defaulted long enums and a failing reallocator 2017-07-22 21:46:16 +02:00
Rhodri James
e909b67123 Test attribute list with a NOTATION and default value 2017-07-22 21:46:16 +02:00
Rhodri James
5f124f4e7c Test attribute with implied large enum with a failing reallocator 2017-07-22 21:46:16 +02:00
Rhodri James
98ead688f1 Expand attribute declaration test 2017-07-22 21:46:16 +02:00
Rhodri James
9bb1b1e554 Test attribute list handling with #REQUIRED 2017-07-22 21:46:16 +02:00
Sebastian Pipping
5a642dd1e5 runtests.c: Resolve setting handlers twice
Was introduced at cherry-pick ab53439060
by mistake.
2017-07-22 21:39:56 +02:00
Sebastian Pipping
04ea5302cd runtests.c: Fix memleaks 2017-07-22 21:36:55 +02:00
Rhodri James
58ecc804be Test long attribute enums with a failing reallocator 2017-07-22 21:31:49 +02:00
Rhodri James
f1b5c14b96 Test attribute enum handling with failing allocator 2017-07-22 21:31:45 +02:00
Rhodri James
66435cff61 Test attribute enum value handling 2017-07-22 21:31:40 +02:00
Rhodri James
8857da5a65 Test foreign DTD with no contents 2017-07-22 21:31:12 +02:00
Rhodri James
cfcfd4685f Test foreign DTD with rejecting standalone handler 2017-07-22 21:31:07 +02:00
Rhodri James
060c12bc19 Test Foreign DTD setting with failing allocator 2017-07-22 21:31:02 +02:00
Rhodri James
f03d06a8c1 Test XML_UseForeignDTD without external subset 2017-07-22 21:30:57 +02:00
Rhodri James
234c654c19 Test XML_UseForeignDTD with a doctype 2017-07-22 21:30:52 +02:00
Rhodri James
4c197b0ef9 Add entity declaration handler to public parameter entity test 2017-07-22 21:30:47 +02:00
Rhodri James
604a527186 Test long public name in doctype allocator test 2017-07-22 21:30:42 +02:00
Rhodri James
8d42ab97d9 Test invalid name for public doctype 2017-07-22 21:30:37 +02:00
Rhodri James
ddddcfd393 Expand public doctype allocation test 2017-07-22 21:30:32 +02:00
Rhodri James
9223704553 Test allocation failure paths parsing a public doctype 2017-07-22 21:30:27 +02:00
Rhodri James
8babc25e44 Test public parameter entity with failing allocator 2017-07-22 21:30:22 +02:00
Rhodri James
e57d2413a1 Test various errors in parameter entity values 2017-07-22 21:30:17 +02:00
Rhodri James
78138c87f4 Test invalid character in foreign DTD parameter entity 2017-07-22 21:30:12 +02:00
Rhodri James
e5d84961bb Fix error reporting in external entity test handler 2017-07-22 21:29:55 +02:00
Rhodri James
9de593495c Test UTF-8 byte order mark in parameter entity value parsing 2017-07-22 21:29:13 +02:00
Rhodri James
c45340e138 Test aborting external entity value parser 2017-07-22 21:29:08 +02:00