1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +00:00

fix(crypto): clarify incorrect base58.c code comment

This commit is contained in:
Christian Reitter 2021-11-27 13:32:41 +01:00 committed by Andrew Kozlik
parent 38c526719c
commit 91dd21b561

View File

@ -119,7 +119,11 @@ bool decode_block(const char* block, size_t size, char* res)
return false; // Overflow
res_num = tmp;
order *= alphabet_size; // Never overflows, 58^10 < 2^64
// The original code comment for the order multiplication says
// "Never overflows, 58^10 < 2^64"
// This is incorrect since it overflows on the 11th iteration
// However, there is no negative impact since the result is unused
order *= alphabet_size;
}
if ((size_t)res_size < full_block_size && (UINT64_C(1) << (8 * res_size)) <= res_num)