Vulnerability fixes

This commit is contained in:
James Thompson
2024-12-17 15:26:41 +00:00
parent e640915d4e
commit c11caffbd7
2 changed files with 12 additions and 1 deletions

View File

@@ -1132,7 +1132,17 @@ void ParseV3000ParseLabel(const std::string &label,
} else if (label == "PARENT") {
// Store relationship until all SGroups have been read
unsigned int parentIdx;
if (lineStream.eof()) {
std::ostringstream errout;
errout << "PARENT label not found on line " << line;
throw FileParseException(errout.str());
}
lineStream >> parentIdx;
if (lineStream.fail()) {
std::ostringstream errout;
errout << "Invalid PARENT label found on line " << line;
throw FileParseException(errout.str());
}
sgroup.setProp<unsigned int>("PARENT", parentIdx);
} else if (label == "COMPNO") {
unsigned int compno;

View File

@@ -692,6 +692,7 @@ template <typename Iterator>
void parse_data_sgroup_attr(Iterator &first, Iterator last,
SubstanceGroup &sgroup, bool keepSGroup,
std::string fieldName, bool fieldIsArray = false) {
PRECONDITION(first < last);
if (first != last && *first != '|') {
std::string data = read_text_to(first, last, ":");
++first;
@@ -744,7 +745,7 @@ bool parse_data_sgroup(Iterator &first, Iterator last, RDKit::RWMol &mol,
}
parse_data_sgroup_attr(first, last, sgroup, keepSGroup, "DATAFIELDS", true);
parse_data_sgroup_attr(first, last, sgroup, keepSGroup, "QUERYOP");
parse_data_sgroup_attr(first, last, sgroup, keepSGroup, "FIELDINFO");