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

Request with body containing null character raises ArgumentError #6

Open
floehopper opened this issue Jun 25, 2014 · 2 comments
Open

Comments

@floehopper
Copy link
Contributor

I've seen a few instances of this happening on a production server. Now that I've investigated this further, I think the root of the problem is that Rack is not correctly parsing some headers containing unicode characters. This means that some of the header text is "leaking" out into the request body. Rack then tries to interpret this body text as form fields which (in the case I have seen) results in a single hash "key" containing what look like unicode characters. If some of the bytes are the null character, then vanilla raises an ArgumentError (see below) when trying to convert [1] the "key" to a symbol (at least in Ruby 1.8.7). I believe the error is due to this line of Ruby C code [2]. It's obvious that the real problem does not lie within vanilla, but I do wonder whether it's worth making vanilla more robust to keys that cannot be converted to symbols. In any case I'll pursue the root case of the problem with the Rack project.

ArgumentError occured: symbol string may not contain `\0'

[1] https://github.com/lazyatom/vanilla-rb/blob/master/lib/vanilla/request.rb#L19
[2] https://github.com/ruby/ruby/blob/v1_8_7/string.c#L4530

@lazyatom
Copy link
Owner

Do you have an example request that I can try to replay locally?

@floehopper
Copy link
Contributor Author

I'll forward you an example exception notifier email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants