Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   YAML.dump/YAML.load bug (http://www.velocityreviews.com/forums/t823388-yaml-dump-yaml-load-bug.html)

Paul Battley 08-03-2005 08:28 PM

YAML.dump/YAML.load bug
 
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.




All times are GMT. The time now is 04:37 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.