|
| 1 | +#include <boost/regex.hpp> |
| 2 | + |
| 3 | +#include <vector> |
| 4 | +#include <string> |
| 5 | + |
| 6 | +#include "test_macros.hpp" |
| 7 | + |
| 8 | + |
| 9 | +int main() |
| 10 | +{ |
| 11 | + // invalid because \k-- is an unterminated token |
| 12 | + { |
| 13 | + char const strdata[] = "\\k--00000000000000000000000000000000000000000000000000000000009223372036854775807\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90"; |
| 14 | + std::string regex_string(strdata, strdata + sizeof(strdata) - 1); |
| 15 | + BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error); |
| 16 | + } |
| 17 | + { |
| 18 | + char const strdata[] = "\\k-00000000000000000000000000000000000000000000000000000000009223372036854775807\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90"; |
| 19 | + std::string regex_string(strdata, strdata + sizeof(strdata) - 1); |
| 20 | + BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error); |
| 21 | + } |
| 22 | + { |
| 23 | + char const strdata[] = "\\k00000000000000000000000000000000000000000000000000000000009223372036854775807\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90"; |
| 24 | + std::string regex_string(strdata, strdata + sizeof(strdata) - 1); |
| 25 | + BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error); |
| 26 | + } |
| 27 | + { |
| 28 | + char const strdata[] = "a(b*)c\\k{--1}d"; |
| 29 | + std::string regex_string(strdata, strdata + sizeof(strdata) - 1); |
| 30 | + BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error); |
| 31 | + } |
| 32 | + { |
| 33 | + char const strdata[] = "a(b*)c\\k-{-1}d"; |
| 34 | + std::string regex_string(strdata, strdata + sizeof(strdata) - 1); |
| 35 | + BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error); |
| 36 | + } |
| 37 | + { |
| 38 | + char const strdata[] = "\\k{--00000000000000000000000000000000000000000000000000000000009223372036854775807}\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90"; |
| 39 | + std::string regex_string(strdata, strdata + sizeof(strdata) - 1); |
| 40 | + BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error); |
| 41 | + } |
| 42 | + { |
| 43 | + char const strdata[] = "\\k{-00000000000000000000000000000000000000000000000000000000009223372036854775807}\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90"; |
| 44 | + std::string regex_string(strdata, strdata + sizeof(strdata) - 1); |
| 45 | + BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error); |
| 46 | + } |
| 47 | + { |
| 48 | + char const strdata[] = "\\k{00000000000000000000000000000000000000000000000000000000009223372036854775807}\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90"; |
| 49 | + std::string regex_string(strdata, strdata + sizeof(strdata) - 1); |
| 50 | + BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error); |
| 51 | + } |
| 52 | + |
| 53 | + return boost::report_errors(); |
| 54 | +} |
0 commit comments