Skip to content

Commit 5fb9f6f

Browse files
author
William Jakobsson
committed
fix-14657
1 parent 324ae91 commit 5fb9f6f

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

lib/errorlogger.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,13 +1082,12 @@ std::string getGuideline(const std::string &errId, ReportType reportType,
10821082
case ReportType::misraC2025:
10831083
if (errId.rfind("misra-c20", 0) == 0 || errId.rfind("premium-misra-c-20", 0) == 0) {
10841084
auto pos1 = errId.find("20") + 5;
1085+
if (pos1 >= errId.size())
1086+
break;
10851087
if (errId.compare(pos1,4,"dir-",0,4) == 0)
10861088
pos1 += 4;
10871089
const auto endpos = errId.find('-', pos1);
1088-
if (endpos != std::string::npos)
1089-
guideline = errId.substr(pos1, endpos-pos1);
1090-
else
1091-
guideline = errId.substr(pos1);
1090+
guideline = errId.substr(pos1, endpos-pos1);
10921091
}
10931092
break;
10941093
case ReportType::misraCpp2008:

0 commit comments

Comments
 (0)