From 1f74bf1edcae00bd33a2ecbcd9838b4d98f810b2 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 29 Aug 2010 15:16:55 +0000 Subject: 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 --- tests/test_xpath_parse.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tests/test_xpath_parse.cpp') diff --git a/tests/test_xpath_parse.cpp b/tests/test_xpath_parse.cpp index b8e46d9..f17357b 100644 --- a/tests/test_xpath_parse.cpp +++ b/tests/test_xpath_parse.cpp @@ -269,15 +269,25 @@ TEST_XML(xpath_parse_absolute, "
") CHECK_XPATH_NODESET(doc, STR("/*[/]")) % 2; } -TEST(xpath_parse_out_of_memory) +TEST(xpath_parse_out_of_memory_first_page) { test_runner::_memory_fail_threshold = 1; CHECK_XPATH_FAIL(STR("1")); +} +TEST(xpath_parse_out_of_memory_second_page_node) +{ test_runner::_memory_fail_threshold = 8192; CHECK_XPATH_FAIL(STR("1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1")); } +TEST(xpath_parse_out_of_memory_string_to_number) +{ + test_runner::_memory_fail_threshold = 4096 + 128; + + CHECK_XPATH_FAIL(STR("0.11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")); +} + #endif -- cgit v1.2.3