I stumbled upon a bug in itfile.cpp concerning reading and writing std::string on 64bit platforms. I'm referring to version 3.99.1.
The problem is that in it_file::low_level_write(const std::string &str) on line 721,
s << str.size();
saves a 64bit value. However, in it_ifile::low_level_read(std::string &str) on line 283 we have
s >> i;
which reads a 32bit value. The effect is that the string that we read then starts with 4 0-bytes and the last 4 characters of the string are cut off. E.g., the string "12345678" would be read in as "\0\0\0\01234".
The easiest bugfix would probably be to replace line 279
int i, j;
size_t i, j;
as sizeof(size_t) is 4 on 32bit platforms and 8 on 64bit platforms.
There might be more similar bugs in the file, so maybe someone who knows the code should have a closer look...