Fixed check for base64 char values

pull/3514/head
Max Vollmer 2020-11-30 16:21:29 +00:00
parent 7d72c78c8e
commit 53ff0702ce
1 changed files with 2 additions and 2 deletions

View File

@ -249,10 +249,10 @@ inline char EncodeCharBase64(uint8_t b) {
} }
inline uint8_t DecodeCharBase64(char c) { inline uint8_t DecodeCharBase64(char c) {
if (c & 0xF0) { if (c & 0x80) {
throw DeadlyImportError("Invalid base64 char value: ", size_t(c)); throw DeadlyImportError("Invalid base64 char value: ", size_t(c));
} }
return DATA<true>::tableDecodeBase64[size_t(c & 0x0F)]; // TODO faster with lookup table or ifs? return DATA<true>::tableDecodeBase64[size_t(c & 0x7F)]; // TODO faster with lookup table or ifs?
} }
size_t DecodeBase64(const char *in, size_t inLength, uint8_t *&out); size_t DecodeBase64(const char *in, size_t inLength, uint8_t *&out);