Commit Graph

1962 Commits

Author SHA1 Message Date
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
7c11f77a03 Comment change: exclude more unreachable code from coverage 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
6fd7365bfb Comment change: exclude unreachable condition from coverage 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
fc06a529a3 Reject multi-byte encodings with no converter function.
Not supplying a character encoding convert function when one was
needed previously caused a segfault if a multi-byte character was
encountered.  This errors at the start of parse instead.
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
c2e90b3ebb Mark the second uppercasing in streqci() as unreacheable for coverage tests 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
8f1346cdbe Add utility script file to tidy up after running coverage tests 2017-07-22 22:49:16 +02:00
Rhodri James
c1541fa19a Ignore directories created by coverage script 2017-07-22 22:49:16 +02:00
Rhodri James
043e9923a3 Fix LCOV exclusion symbols in xmlparse.c 2017-07-22 22:49:16 +02:00
Rhodri James
5f06552ba3 Comment why negative blocksize in poolGrow is hard to test
Also add comment tags for lcov to ignore untestable code
2017-07-22 22:49:16 +02:00
Rhodri James
97aa338029 Comment why negative blocksize in poolGrow is hard to test
Add comment tags so lcov can ignore untestable code
2017-07-22 22:49:16 +02:00
Rhodri James
c6236c8a59 Comment why poolCopyStringN is not entered with an empty string pool
Also add comment tags so that lcov can ignore unreachable code.
2017-07-22 22:49:16 +02:00
Rhodri James
f8505ea55b Comment why an unbound prefix in getContext is believed impossible
Also add comment tags so that lcov can ignore unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
e35f05fb5f Comment why allocation failure in getContext is believe impossible.
Also add comment tags so lcov can ignore unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
d81e238f96 Comment why encoding change in reportDefault is believed never to happen
Also add comment tags so that lcov can ignore unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
fc3a968f47 Comment why default case in storeEntityValue is never executed
Also add comment tags so lcov can ignore unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
92cf2a3179 Remove unreachable error code in character ref handling 2017-07-22 22:49:16 +02:00
Rhodri James
10103bcd04 Comment why defaul case in appendAttreibuteValue is never executed
Also add comment tags so that lcov can ignore unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
f7229958bf Comment why encoding check in appendAttributeValue is never true
Also add comment tag so lcov can ignore unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
758e83d100 Remove unreachable error handling code in character ref handling 2017-07-22 22:49:16 +02:00
Rhodri James
ea51dfcbdb Comment why internal entity in param entity is believe impossible.
Also add comment tags to allow lcov to ignore unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
fc64cd121d Comment why external subset name lookup cannot fail
Also add comment tag so that lcov can ignore unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
d6549087b4 Remove unreachable code in entityValueInitProcessor 2017-07-22 22:49:16 +02:00
Rhodri James
e1a7cc2712 Comment why doIgnoreSection's default case is never called.
Also add comment tags so that lcov can ignore unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
860933367a Comment why doIgnoreSection is believed to always use the parser's encoding
Also add comment tags so that lcov can ignore the unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
5214e4427a Comment why doCdataSection's default case is never executed.
Also add comment tags so that lcov can ignore the unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
766d6d3509 Comment why code in storeAtts() is never executed.
Also add comment tags so lcov can ignore the unreachable code
2017-07-22 22:49:16 +02:00
Rhodri James
351a8cb321 Comment why doContent's default case is never executed.
Also add comment markers so lcov can ignore the unreachable code.
2017-07-22 22:49:16 +02:00
Rhodri James
a420a3b8ef Comment why tidy-up parse cannot be suspended
Also add tags so that lcov can ignore the unreachable code.
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