Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML: correctly parse scalar value having null character #4763



Copy link

Old implementation ignores the scalar value after null character because it ignores scalar value length reported by libyaml. So I fix to use it, then this example works well now:

require "yaml"

s = String.from_yaml %q(--- "foo\0bar")
p s # => "foo\u0000bar"

Copy link

Thanks. We should always use reported size, instead of relying on strlen call.

@ysbaddaden ysbaddaden merged commit 5b71ddf into crystal-lang:master Jul 31, 2017
@makenowjust makenowjust deleted the fix/yaml/null-safe-scalar branch July 31, 2017 08:41
Copy link
Contributor Author

Thank you @straight-shoota , @RX14 and @ysbaddaden !

@ysbaddaden ysbaddaden added this to the Next milestone Aug 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants