From: "drbrain (Eric Hodel)" Date: 2013-08-19T03:08:53+09:00 Subject: [ruby-core:56726] [ruby-trunk - Bug #8795] "Null byte in string error" on Marshal.load Issue #8795 has been updated by drbrain (Eric Hodel). Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: REQUIRED By the way, I used the marshal-structure gem to discover the problem, along with adding a breakpoint in ruby to determine where in the stack the error occurred. https://rubygems.org/gems/marshal-structure ---------------------------------------- Bug #8795: "Null byte in string error" on Marshal.load https://bugs.ruby-lang.org/issues/8795#change-41255 Author: mml (McClain Looney) Status: Closed Priority: Normal Assignee: naruse (Yui NARUSE) Category: core Target version: ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux] Backport: 1.9.3: DONTNEED, 2.0.0: REQUIRED I have about 2M serialized ruby objects in a database (don't ask). The objects are serialized via Marshal.dump, then zipped, then base64 encoded before being saved. After upgrading to 2.0 (built from source), a tiny minority (3-4) of objects thusly stored will fail to Marshal.load, with "ArgumentError: Null byte in string" Given that the other 1.9M objects load just fine, and the issue never manifested in 1.8.7 MRI, and further, that the zip CRC's & such were not corrupted, I suspect there may be some subtle bug in the Marshal.dump code. Please see attached file for a sample. I'd be happy if there'd even be any way to "fix" said broken string, or even any insight into what might be going on, but I'm more worried that there may be a Marshal bug lurking.. -- http://bugs.ruby-lang.org/