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

Kernel.exec should raise an ArgumentError if the command includes a null byte #704

Merged
merged 1 commit into from May 4, 2013

Conversation

Projects
None yet
2 participants
@atambo
Member

atambo commented May 4, 2013

No description provided.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius May 4, 2013

Member

I think the spirit of this spec is that if a null byte appears anywhere in the String, we should raise the error.

A couple other notes:

  • Don't remove the convertToString. The error that results from passing a non-String would go away.
  • After the convertToString, you have a RubyString in hand. You can get the ByteList out of it and walk the bytes directly, which will be more efficient than converting to a Java string.
Member

headius commented May 4, 2013

I think the spirit of this spec is that if a null byte appears anywhere in the String, we should raise the error.

A couple other notes:

  • Don't remove the convertToString. The error that results from passing a non-String would go away.
  • After the convertToString, you have a RubyString in hand. You can get the ByteList out of it and walk the bytes directly, which will be more efficient than converting to a Java string.
@atambo

This comment has been minimized.

Show comment
Hide comment
@atambo

atambo May 4, 2013

Member

Done. Let me know if the amended commit above doesn't cover everything.

Member

atambo commented May 4, 2013

Done. Let me know if the amended commit above doesn't cover everything.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius May 4, 2013

Member

you can actually iterate the raw bytes directly, using "getUnsafeBytes", but this is fine for now. I doubt anyone will have a command line long enough to be a performance problem :-)

Merging shortly.

Member

headius commented May 4, 2013

you can actually iterate the raw bytes directly, using "getUnsafeBytes", but this is fine for now. I doubt anyone will have a command line long enough to be a performance problem :-)

Merging shortly.

headius added a commit that referenced this pull request May 4, 2013

Merge pull request #704 from atambo/kernel_exec_error_on_null_byte
Kernel.exec should raise an ArgumentError if the command includes a null byte

@headius headius merged commit d90f2db into jruby:master May 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment