alternator/base64: fix harmless integer overflow
We assign 255 to an int8_t, but 255 isn't representable as an int8_t. Change to the bitwise equivalent but representable -1. Found by clang.
This commit is contained in:
@@ -38,7 +38,7 @@ public:
|
||||
base64_chars() {
|
||||
static_assert(sizeof(to) == 64 + 1);
|
||||
for (int i = 0; i < 255; i++) {
|
||||
from[i] = 255; // signal invalid character
|
||||
from[i] = -1; // signal invalid character
|
||||
}
|
||||
for (int i = 0; i < 64; i++) {
|
||||
from[(unsigned) to[i]] = i;
|
||||
|
||||
Reference in New Issue
Block a user