From 4879c6db471bda1d37cbf820860ffbb0c2924a7c Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 15 Mar 2012 22:49:10 +0000 Subject: [PATCH] Fixed out-of-bounds string indexing in ck2cti --- src/converters/CKParser.cpp | 2 +- src/converters/ck2ct.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/converters/CKParser.cpp b/src/converters/CKParser.cpp index 177e4aea2..afa97e6e5 100644 --- a/src/converters/CKParser.cpp +++ b/src/converters/CKParser.cpp @@ -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); diff --git a/src/converters/ck2ct.cpp b/src/converters/ck2ct.cpp index 6e79be5f3..3915c5920 100644 --- a/src/converters/ck2ct.cpp +++ b/src/converters/ck2ct.cpp @@ -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