diff --git a/plugins/builtin/source/content/providers/base64_provider.cpp b/plugins/builtin/source/content/providers/base64_provider.cpp index e84ed48b7..0fe565729 100644 --- a/plugins/builtin/source/content/providers/base64_provider.cpp +++ b/plugins/builtin/source/content/providers/base64_provider.cpp @@ -7,7 +7,7 @@ namespace hex::plugin::builtin { void Base64Provider::readRaw(u64 offset, void *buffer, size_t size) { const u64 base64Offset = 4 * (offset / 3); - const u64 base64Size = hex::alignTo(4 * (size / 3), 4) + 4; + const u64 base64Size = std::min(hex::alignTo(4 * (size / 3), 4) + 4, m_fileSize); std::vector bytes(base64Size); FileProvider::readRaw(base64Offset, bytes.data(), bytes.size());