[serialization] crash with save/load binary

Robert, the attached program crashes for me, and I can't understand why. There's a class which contains an array and stores/loads that array. When I run the program, I see: Saving 3{3 4 5 6 } Saving 2{2 3 } Read 3{3 4 5 6 } Aborted That is, first object is deserialized correctly, but the second is not. Is there something wrong with my code, or it's a bug in serialization library? Thanks in advance, Volodya

Vladimir Prus wrote:
Robert, the attached program crashes for me, and I can't understand why.
I think I know now. The 'save_binary' method uses base64 encoding. The RFC 3548 says that: The encoding process represents 24-bit groups of input bits as output strings of 4 encoded characters. ... Special processing is performed if fewer than 24 bits are available at the end of the data being encoded. That special processing is adding of '=' symbols at the end. Now, it looks like your base64 encoder does not deal with padding. In my case, it generated a strings of 22 characters -- and that's no multiple of 4. I suspect that after that, reading grabs two additional characters, after which everything goes wrong. What do you think? - Volodya
participants (1)
-
Vladimir Prus