Browse Source

Don't call findBase64CharIndex on invalid chars

tags/1.9.7
falkTX 9 years ago
parent
commit
f4caa66a4b
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      source/utils/CarlaBase64Utils.hpp

+ 3
- 3
source/utils/CarlaBase64Utils.hpp View File

@@ -101,12 +101,12 @@ std::vector<uint8_t> carla_getChunkFromBase64String(const char* const base64stri

if (i != 0)
{
for (j=0; j<i && j<4; ++j)
charArray4[j] = CarlaBase64Helpers::findBase64CharIndex(static_cast<char>(charArray4[j]));

for (j=i; j<4; ++j)
charArray4[j] = 0;

for (j=0; j<4; ++j)
charArray4[j] = CarlaBase64Helpers::findBase64CharIndex(static_cast<char>(charArray4[j]));

charArray3[0] = (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4);
charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2);
charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3];


Loading…
Cancel
Save