Fix "one past end" illegal iterator computation

This commit is contained in:
Dmitry-Me 2019-11-20 18:10:05 +03:00
parent c990d10ffa
commit 28ef31c981
1 changed files with 1 additions and 2 deletions

View File

@ -1222,8 +1222,7 @@ void CheckIO::checkFormatString(const Token * const tok,
case 'h': // Can be 'hh' (signed char or unsigned char) or 'h' (short int or unsigned short int)
case 'l': { // Can be 'll' (long long int or unsigned long long int) or 'l' (long int or unsigned long int)
// If the next character is the same (which makes 'hh' or 'll') then expect another alphabetical character
const bool isSecondCharAvailable = ((i + 1) != formatString.end());
if (i != formatString.end() && isSecondCharAvailable && *(i + 1) == *i) {
if (i != formatString.end() && (i + 1) != formatString.end() && *(i + 1) == *i) {
if (!isalpha(*(i + 2))) {
std::string modifier;
modifier += *i;