Arseny Kapoulkine
56c9afa7c8
XPath: Improve recursion limit for deep chains of //
...
Since foo//bar//baz adds two nodes for each //, we need to increment the
depth by 2 on each iteration to limit the AST correctly.
Fixes the stack overflow found by cluster-fuzz (I suspect the issue
there is a bit deeper, but this part is definitely a bug and as such I'd
rather wait for the next test case for now).
2021-05-11 22:27:53 -07:00
Arseny Kapoulkine
8e5b8e0f46
XPath: Fix stack overflow in functions with long argument lists
...
Function call arguments are stored in a list which is processed
recursively during optimize(). We now limit the depth of this construct
as well to make sure optimize() doesn't run out of stack space.
2020-09-11 09:50:41 -07:00
Arseny Kapoulkine
20aef1cd4b
Fix stack overflow in tests on MSVC x64
...
The default stack on MSVC/x64/debug is sufficient for 1692 nested
invocations only, whereas on clang/linux it's ~8K...
For now set the limit to be conservative.
2020-09-10 09:11:46 -07:00
Arseny Kapoulkine
c7090e6c33
Fix tests in wchar mode
2020-09-10 01:07:48 -07:00
Arseny Kapoulkine
1f84db837b
XPath: Restrict AST depth to prevent stack overflow
...
XPath parser and execution engine isn't stackless; the depth of the
query controls the amount of C stack space required.
This change instruments places in the parser where the control flow can
recurse, requiring too much C stack space to produce an AST, or where a
stackless parse is used to produce arbitrarily deep AST which will
create issues for downstream processing.
As a result XPath parser should now be fuzz safe for malicious inputs.
2020-09-10 00:55:26 -07:00
Arseny Kapoulkine
5867aff943
tests: Make using namespace more explicit
...
Hiding using namespace in common.hpp is somewhat surprising so remove
common.hpp and move using namespace into all .cpp files that need it.
2017-06-22 20:41:08 -07:00
Arseny Kapoulkine
4b371e10ee
tests: Remove redundant pugi:: qualifier
...
Most tests have `using namespace pugi` which makes explicit
qualifications unnecessary.
2017-06-22 20:33:02 -07:00
Arseny Kapoulkine
ef64bef5c3
tests: More XPath coverage tests
2017-01-31 00:35:15 -08:00
Arseny Kapoulkine
a1bc15c8d5
tests: Add more coverage tests
...
Expand out of memory coverage during XPath parsing and evaluation and
add some other small tests.
2017-01-30 23:52:32 -08:00
Arseny Kapoulkine
02cee98492
tests: Add more tests for branch coverage
...
gcov -b surfaced many lines with partial coverage, where branch is only
ever taken or not taken, or one of the expressions in a complex
conditional is always either true or false. This change adds a series of
tests (mostly focusing on XPath) to reduce the number of partially
covered lines.
2017-01-30 21:58:48 -08:00
Arseny Kapoulkine
cac1d8ad9f
tests: Add an error propagation test for XPath
...
This test is supposed to test error coverage in different expressions
that are nested in other expressions to reduce the number of never-taken
branches in tests (and make sure we aren't missing any).
2017-01-30 11:51:07 -08:00
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
6bc4357567
tests: Fixed CW compilation
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@773 99668b35-9821-0410-8761-19e4c4f06640
2010-10-22 04:28:52 +00:00
arseny.kapoulkine
f725ff1170
tests: Fixed XPath OOM tests, added parsing exception test
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@760 99668b35-9821-0410-8761-19e4c4f06640
2010-10-03 14:28:18 +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
a0a28b1c05
tests: Fixed test warnings for MSVC10, slightly extended substring tests
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@707 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29 20:57:42 +00:00
arseny.kapoulkine
771c8ecc2f
tests: Added more XPath tests
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@683 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29 15:41:16 +00:00
arseny.kapoulkine
61ceb10baf
tests: Added more XPath variable tests
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@681 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29 15:39:43 +00:00
arseny.kapoulkine
1f74bf1edc
XPath: Correct out of memory handling for string to number conversion during parsing, added corresponding test
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@651 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29 15:16:55 +00:00
arseny.kapoulkine
7aadde4229
tests: Added XPath out of memory parse test
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@648 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29 15:14:48 +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
8af48d7e23
tests: Added /[1] test
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@486 99668b35-9821-0410-8761-19e4c4f06640
2010-05-31 16:55:16 +00:00
arseny.kapoulkine
4c0e67ae92
XPath: Replaced backtracking with lookahead in absolute path parsing
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@485 99668b35-9821-0410-8761-19e4c4f06640
2010-05-31 16:53:13 +00:00
arseny.kapoulkine
2f88c5dbdf
tests: Added more XPath parsing tests
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@481 99668b35-9821-0410-8761-19e4c4f06640
2010-05-31 11:43:54 +00:00
arseny.kapoulkine
555a184f4f
Fixed XPath parsing (numbers of the form \d+\. are now parsed correctly, stray colon does not act as eof token)
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@476 99668b35-9821-0410-8761-19e4c4f06640
2010-05-30 20:44:15 +00:00
arseny.kapoulkine
d567700d19
tests: Added more tests (including a couple of failing ones)
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@474 99668b35-9821-0410-8761-19e4c4f06640
2010-05-30 18:21:49 +00:00
arseny.kapoulkine
1f62a006f1
tests: Added more Xalan tests
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@464 99668b35-9821-0410-8761-19e4c4f06640
2010-05-29 16:27:46 +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
f02208b12f
tests: Final coverage improvements
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@229 99668b35-9821-0410-8761-19e4c4f06640
2009-11-08 16:15:05 +00:00
arseny.kapoulkine
eefd73bc4e
tests: More XPath coverage
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@226 99668b35-9821-0410-8761-19e4c4f06640
2009-11-08 15:30:49 +00:00
arseny.kapoulkine
0cac815b63
tests: More coverage tests
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@225 99668b35-9821-0410-8761-19e4c4f06640
2009-11-08 15:17:46 +00:00
arseny.kapoulkine
e3293a8baa
tests: Mostly complete coverage of XPath W3C
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@217 99668b35-9821-0410-8761-19e4c4f06640
2009-11-08 12:25:56 +00:00
arseny.kapoulkine
6948d1f171
tests: Completed function library tests, added namespace axis and variable reference tests
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@204 99668b35-9821-0410-8761-19e4c4f06640
2009-11-04 19:23:20 +00:00
arseny.kapoulkine
fc602fd375
tests: Supported all pugixml compilation modes
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@191 99668b35-9821-0410-8761-19e4c4f06640
2009-10-29 07:17:30 +00:00
arseny.kapoulkine
fb689fed2b
tests: More decimal digits are tested
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@177 99668b35-9821-0410-8761-19e4c4f06640
2009-10-27 20:16:08 +00:00
arseny.kapoulkine
40c0a5f09a
tests: Added basic XPath tests
...
git-svn-id: http://pugixml.googlecode.com/svn/trunk@170 99668b35-9821-0410-8761-19e4c4f06640
2009-10-21 19:09:12 +00:00