Skip to content

Fix determing if option inside magic comments requires an arguement #9562

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

Closed
wants to merge 1 commit into from

Conversation

mikhailnov
Copy link
Contributor

Test:

$ echo '#!ruby -0 --disable' > file.rb
$ ruby file.rb

Ruby crashed with segmentation fault, because is_option_with_arg("disable", Qtrue, Qtrue) in ruby.c:1399 (per tree of commit 7b6731b) returned true, while it must return false.

But

$ ruby -0 --disable

does not crash, is_option_with_arg("disable", Qtrue, Qtrue) in ruby.c:1399 correctly returns false.

I suspect that a good fix must be done somewhere else, but I cannot understand the difference between two cases described above, so just adding a check.

Not sure that this patch does not break anything.

Test:
$ echo '#!ruby -0 --disable' > file.rb
$ ruby file.rb
Ruby crashed with segmentation fault, because is_option_with_arg("disable", Qtrue, Qtrue) in ruby.c:1399
(per tree of commit 7b6731b)
returned true, while it must return false.

But
$ ruby -0 --disable
does not crash, is_option_with_arg("disable", Qtrue, Qtrue) in ruby.c:1399 correctly returns false.

I suspect that a good fix must be done somewhere else,
but I cannot understand the difference between two cases described above,
so just adding a check.
@mikhailnov mikhailnov mentioned this pull request Jan 16, 2024
nobu added a commit to nobu/ruby that referenced this pull request Jan 17, 2024
@nobu nobu closed this in #9575 Jan 17, 2024
nobu added a commit that referenced this pull request Jan 17, 2024
@mikhailnov
Copy link
Contributor Author

Thanks!

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

Successfully merging this pull request may close these issues.

1 participant