Test for CVE-2018-20573

This commit is contained in:
Alan Griffiths 2020-01-20 16:13:21 +00:00
parent 452675f701
commit 1d1fdfeb13

View File

@ -27,3 +27,14 @@ TEST(ParserTest, CVE_2017_5950) {
NiceMock<MockEventHandler> handler;
EXPECT_THROW(parser.HandleNextDocument(handler), YAML::ParserException);
}
TEST(ParserTest, CVE_2018_20573) {
std::string excessive_recursion;
for (auto i = 0; i != 20535; ++i)
excessive_recursion.push_back('{');
std::istringstream input{excessive_recursion};
Parser parser{input};
NiceMock<MockEventHandler> handler;
EXPECT_THROW(parser.HandleNextDocument(handler), YAML::ParserException);
}