Skip to content
Snippets Groups Projects
Unverified Commit ef4af2a1 authored by Xavier Robin's avatar Xavier Robin
Browse files

fix: check length of counts line

This improves error messages when the counts line is invalid and the
calls to substr() return raw C++ errors.
parent 2d8d6efc
No related branches found
No related tags found
No related merge requests found
......@@ -159,6 +159,11 @@ void SDFReader::ParseAndAddHeader(const String& line, int line_num,
break;
case 4: // counts line
{
if (line.length() < 39) {
String msg="Bad counts line %d: Not correct number of characters on "
"the line: %i (should be at least 39)";
throw IOException(str(format(msg) % line_num % line.length()));
}
String version_str=line.substr(34, 5);
if (version_str != "V2000") {
String msg="Unsupported SDF version: %s.";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment