bwalex / tc-play

Free and simple TrueCrypt/VeraCrypt Implementation based on dm-crypt
BSD 2-Clause "Simplified" License
551 stars 56 forks source link

tc-play-2.0/tcplay.c:187: bad loop #66

Closed dcb314 closed 4 years ago

dcb314 commented 9 years ago

tc-play-2.0/tcplay.c:187:6: warning: loop exit may only be reached after undefined behavior [-Waggressive-loop-optimizations]

   while (valid_cipher_chains[i][k] != NULL) {
        // ...
   }
   // ...
           /* Integrity check */
    if (i >= MAX_CIPHER_CHAINS) {
        tc_log(1, "FATAL: tc_cipher_chains is full!!\n");
        return -1;
    }

Suggest check array index before use.

bwalex commented 4 years ago

I don't get that even with an explicit -Waggressive-loop-optimizations - either way, it sounded like a static analysis failure.