Fixed out-of-bounds string indexing in ck2cti
This commit is contained in:
parent
f22ecac5c4
commit
4879c6db47
2 changed files with 2 additions and 2 deletions
|
|
@ -370,7 +370,7 @@ void CKParser::getCKLine(std::string& s, std::string& comment)
|
|||
string::size_type icom = line.find(commentChar);
|
||||
|
||||
// lines that begin with !% are not comments for Cantera
|
||||
if (icom == 0 && line[1] == undoCommentChar) {
|
||||
if (icom == 0 && line.size() > 1 && line[1] == undoCommentChar) {
|
||||
line[0] = '%';
|
||||
line[1] = ' ';
|
||||
icom = line.find(commentChar);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ static void getTransportData(string trfile)
|
|||
* can't possibly have enough data in them to comprise a
|
||||
* properly formatted record.
|
||||
*/
|
||||
if (rest[0] != '#' && rest[0] != '!' && rest.size() > 5) {
|
||||
if (rest.size() > 5 && rest[0] != '#' && rest[0] != '!') {
|
||||
/*
|
||||
* copy the string into a stringstream and parse the line
|
||||
* into the trdata object
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue