Skip to content
Snippets Groups Projects
Commit 658a64dc authored by Bienchen's avatar Bienchen
Browse files

Fixed star parser, prevent him from going into an infinite loop if an early line starts with a "d"

parent 3ab0c16a
Branches
Tags
No related merge requests found
......@@ -550,6 +550,8 @@ void StarParser::Parse()
case 'd':
if (tline.length()>=5 && StringRef("data_", 5)==tline.substr(0, 5)) {
this->ParseData();
} else {
throw IOException("Missing 'data_' control structure");
}
break;
case 'g':
......
......@@ -389,6 +389,13 @@ BOOST_AUTO_TEST_CASE(star_items_as_row)
BOOST_TEST_MESSAGE(" done.");
}
BOOST_AUTO_TEST_CASE(star_broken_data)
{
std::ifstream s("testfiles/broken_data.cif");
LoopTestParser star_p(s);
BOOST_CHECK_THROW(star_p.Parse(), IOException);
}
BOOST_AUTO_TEST_CASE(star_missing_data)
{
std::ifstream s("testfiles/missing_data.cif");
......
d lines starting with a 'd' kicked the parser into an infinite loop.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment