YAML.dump/YAML.load bug

Discussion in 'Ruby' started by Paul Battley, Aug 3, 2005.

  1. Paul Battley

    Paul Battley Guest

    I have identified what seems to be a bug in the current Ruby
    implementation of YAML.

    YAML.dump handles binary data without a problem; it is dumped as
    expected. However, when YAML.load is used to read the same data back
    in, it *sometimes* fails. I analysed the exact failure behaviour by
    serialising and deserialising random data, then comparing all the
    failed data until I had pinpointed the exact causes.

    These are the criteria for failure:

    * A string is used as a hash key.
    * The string contains a byte 0x00.
    * The string contains a byte 0x0a in a non-final position.

    When all three criteria are met, YAML.load cannot successfully read
    YAML.dump's output.

    I've made a set of test cases to demonstrate the problem:
    http://po-ru.com/files/breakyaml.rb

    In my tests, it fails on 1.8.2 and the current stable snapshot, on
    both Linux/686 and OS X/PPC.

    Paul Battley.
    Paul Battley, Aug 3, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. halfdog
    Replies:
    12
    Views:
    12,418
  2. Replies:
    0
    Views:
    503
  3. John Trupiano
    Replies:
    1
    Views:
    167
    John Trupiano
    Sep 5, 2008
  4. Jonathan Gold
    Replies:
    0
    Views:
    130
    Jonathan Gold
    May 19, 2009
  5. Pito Salas
    Replies:
    1
    Views:
    123
    Ryan Davis
    Nov 13, 2009
Loading...

Share This Page