[ruby-core:27375] [Bug #2548] Marshal dump/load fails when given an array containing certain (rather silly) symbols

9 views
Skip to first unread message

caleb clausen

unread,
Jan 2, 2010, 7:17:00 PM1/2/10
to ruby...@ruby-lang.org
Bug #2548: Marshal dump/load fails when given an array containing certain (rather silly) symbols
http://redmine.ruby-lang.org/issues/show/2548

Author: caleb clausen
Status: Open, Priority: Normal
ruby -v: ruby 1.9.1p376 (2009-12-07 revision 26040) [x86_64-linux]

Either Marshal.dump or Marshal.load is failing to do the right thing with certain symbols which name backreference variables of unusual size. Here's the simplest example I could find:

$ ruby19 -e 'p Marshal.load Marshal.dump [:$98349576875974523789734582394578,nil]'
-e:1:in `load': dump format error(0x0) (ArgumentError)
from -e:1:in `<main>'

This case works without a problem in ruby 1.8. The problem goes away if the second element of the array is left off, or if the symbol is used by itself without an array enclosing it. Marshal.load is raising the error, but I'm not sure if the problem is there or if Marshal.dump is emitting something incorrect.

Tested on ruby 1.9.1, but I'm guessing 1.9.2 has the same issue.


----------------------------------------
http://redmine.ruby-lang.org

caleb clausen

unread,
Jan 3, 2010, 3:05:35 PM1/3/10
to ruby...@ruby-lang.org
Issue #2548 has been updated by caleb clausen.


I've since discovered that you don't have to use a backreference of unusual size; any backreference will do. A variety of other more normal symbols are also affected. Here's a list of some other failing cases:

$ ruby19 -e 'p Marshal.load Marshal.dump [:$1,nil]


-e:1:in `load': dump format error(0x0) (ArgumentError)
from -e:1:in `<main>'

$ ruby19 -e 'p Marshal.load Marshal.dump [:$0,nil]


-e:1:in `load': dump format error(0x0) (ArgumentError)
from -e:1:in `<main>'

$ ruby19 -e 'p Marshal.load Marshal.dump [:$&,nil]


-e:1:in `load': dump format error(0x0) (ArgumentError)
from -e:1:in `<main>'

$ ruby19 -e 'p Marshal.load Marshal.dump [:$`,nil]


-e:1:in `load': dump format error(0x0) (ArgumentError)
from -e:1:in `<main>'

$ ruby19 -e 'p Marshal.load Marshal.dump [:$$,nil]


-e:1:in `load': dump format error(0x0) (ArgumentError)
from -e:1:in `<main>'

$ ruby19 -e 'p Marshal.load Marshal.dump [:$-a,nil]


-e:1:in `load': dump format error(0x0) (ArgumentError)
from -e:1:in `<main>'

So, the inputs to make this happen aren't so silly after all.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2548

----------------------------------------
http://redmine.ruby-lang.org

Reply all
Reply to author
Forward
0 new messages