std::streambuf in MSVC does not support buffers larger than 2**31 - 1:
https://developercommunity.visualstudio.com/t/stdbasic-stringbuf-is-broken/290124
Simple test to check if it works:
TEST(IMemStreamTest, shouldRead)
{
std::string src(std::numeric_limits<uint32_t>::max() / 2 + 1, '\0');
Files::IMemStream stream(src.data(), src.size());
std::string dst(src.size(), '\0');
stream.read(dst.data(), src.size());
EXPECT_FALSE(stream.fail()) << std::generic_category().message(errno);
}