[ruby-core:93623] [Ruby master Bug#10535] Potential uninitialized reference pipe_open() in io.c
From:
merch-redmine@...
Date:
2019-07-09 02:02:57 UTC
List:
ruby-core #93623
Issue #10535 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Open to Closed
I believe this issue was fixed by commit:aa107497cd379b713eba8cecdb9a882bb1e0dd89, which removed the `argc` and `argv` variables in favor of using `rb_execarg_commandline(eargp, &prog)`, and `eargp` and `prog` are always initialized.
----------------------------------------
Bug #10535: Potential uninitialized reference pipe_open() in io.c
https://bugs.ruby-lang.org/issues/10535#change-79227
* Author: asm (Andy Maloney)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.2.0dev (2014-11-22 trunk 48537) [x86_64-darwin12.0]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
(From git commit f5063b7ea7e774519602f7a112d9acf536a1da33 of 22 November 2014.)
In **io.c** in the following function:
~~~
static VALUE
pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convconfig)
~~~
IF !defined(HAVE_WORKING_FORK) and !defined(HAVE_SPAWNV), THEN argc and argv are declared. (lines 5938, 5939)
Unless I'm missing something in the #if #else #endif fiesta, they don't seem to be initialized anywhere.
Then in the #else case at line 6069, we have this:
~~~
#else
if (argc) {
prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
cmd = StringValueCStr(prog);
}
~~~
Best case, the compiler initializes argc to 0, which means this is dead code. Worst case, the compiler chooses not to initialize to 0, then *Bad Things* will happen.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>