ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:49889] [ruby-trunk - Bug #7423][Open] ruby_process_options() dereferences argv even if argc is zero
@ 2012-11-22 20:39 gfim (Graham Menhennitt)
  2013-05-11 13:29 ` [ruby-core:54912] [ruby-trunk - Bug #7423] " RolandH (Roland Hautz)
  0 siblings, 1 reply; 2+ messages in thread
From: gfim (Graham Menhennitt) @ 2012-11-22 20:39 UTC (permalink / raw
  To: ruby-core


Issue #7423 has been reported by gfim (Graham Menhennitt).

----------------------------------------
Bug #7423: ruby_process_options() dereferences argv even if argc is zero
https://bugs.ruby-lang.org/issues/7423

Author: gfim (Graham Menhennitt)
Status: Open
Priority: Low
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.3p327 (2012-11-10 revision 37606) [i686-linux]


In ruby_process_options(), there is a line:

    ruby_script(argv[0]);  /* for the time being */

This dereferences argv whether argc is zero or not. This causes a SEGV if there are no command line args. It should be changed to something like:

    ruby_script(argc == 0 ? "ruby" : argv[0]);

In practice, this is unlikely to happen since shells never pass argc as zero. However, it can happen in two situations:
- a program calls something like 'static char argv[] = {0}; execv("/usr/bin/ruby", argv);'
- somebody embedding a ruby interpreter explicitly calls ruby_process_options(0, 0);

Argv is used in a number of other places too. These should all be tested for zero arguments.



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:54912] [ruby-trunk - Bug #7423] ruby_process_options() dereferences argv even if argc is zero
  2012-11-22 20:39 [ruby-core:49889] [ruby-trunk - Bug #7423][Open] ruby_process_options() dereferences argv even if argc is zero gfim (Graham Menhennitt)
@ 2013-05-11 13:29 ` RolandH (Roland Hautz)
  0 siblings, 0 replies; 2+ messages in thread
From: RolandH (Roland Hautz) @ 2013-05-11 13:29 UTC (permalink / raw
  To: ruby-core


Issue #7423 has been updated by RolandH (Roland Hautz).


This bug fix is neither on the (complete) Roadmap nor reported under the "Bugs unassociated with any target version". I'm afraid it should be reopened in order to get on the radar for a release.
----------------------------------------
Bug #7423: ruby_process_options() dereferences argv even if argc is zero
https://bugs.ruby-lang.org/issues/7423#change-39251

Author: gfim (Graham Menhennitt)
Status: Closed
Priority: Low
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.3p327 (2012-11-10 revision 37606) [i686-linux]
Backport: 


In ruby_process_options(), there is a line:

    ruby_script(argv[0]);  /* for the time being */

This dereferences argv whether argc is zero or not. This causes a SEGV if there are no command line args. It should be changed to something like:

    ruby_script(argc == 0 ? "ruby" : argv[0]);

In practice, this is unlikely to happen since shells never pass argc as zero. However, it can happen in two situations:
- a program calls something like 'static char argv[] = {0}; execv("/usr/bin/ruby", argv);'
- somebody embedding a ruby interpreter explicitly calls ruby_process_options(0, 0);

Argv is used in a number of other places too. These should all be tested for zero arguments.



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-11 13:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-22 20:39 [ruby-core:49889] [ruby-trunk - Bug #7423][Open] ruby_process_options() dereferences argv even if argc is zero gfim (Graham Menhennitt)
2013-05-11 13:29 ` [ruby-core:54912] [ruby-trunk - Bug #7423] " RolandH (Roland Hautz)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).