1
0
mirror of synced 2024-11-28 01:20:51 +01:00

fix: Reading entire file content of base64 file into memory not working

This commit is contained in:
WerWolv 2024-08-20 20:27:08 +02:00
parent a24692b4be
commit 7011df2ced

View File

@ -7,7 +7,7 @@ namespace hex::plugin::builtin {
void Base64Provider::readRaw(u64 offset, void *buffer, size_t size) { void Base64Provider::readRaw(u64 offset, void *buffer, size_t size) {
const u64 base64Offset = 4 * (offset / 3); const u64 base64Offset = 4 * (offset / 3);
const u64 base64Size = hex::alignTo<u64>(4 * (size / 3), 4) + 4; const u64 base64Size = std::min<u64>(hex::alignTo<u64>(4 * (size / 3), 4) + 4, m_fileSize);
std::vector<u8> bytes(base64Size); std::vector<u8> bytes(base64Size);
FileProvider::readRaw(base64Offset, bytes.data(), bytes.size()); FileProvider::readRaw(base64Offset, bytes.data(), bytes.size());