From 53ff0702ce08d0f9f63b885eebdf2cbf1b516490 Mon Sep 17 00:00:00 2001 From: Max Vollmer Date: Mon, 30 Nov 2020 16:21:29 +0000 Subject: [PATCH] Fixed check for base64 char values --- code/AssetLib/glTF/glTFCommon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/glTF/glTFCommon.h b/code/AssetLib/glTF/glTFCommon.h index bcb319c47..6d402b0e3 100644 --- a/code/AssetLib/glTF/glTFCommon.h +++ b/code/AssetLib/glTF/glTFCommon.h @@ -249,10 +249,10 @@ inline char EncodeCharBase64(uint8_t b) { } inline uint8_t DecodeCharBase64(char c) { - if (c & 0xF0) { + if (c & 0x80) { throw DeadlyImportError("Invalid base64 char value: ", size_t(c)); } - return DATA::tableDecodeBase64[size_t(c & 0x0F)]; // TODO faster with lookup table or ifs? + return DATA::tableDecodeBase64[size_t(c & 0x7F)]; // TODO faster with lookup table or ifs? } size_t DecodeBase64(const char *in, size_t inLength, uint8_t *&out);