Skip to content

Commit

Permalink
merge revision(s) 31655:
Browse files Browse the repository at this point in the history
?\012
	* eval.c (rb_thread_atfork): When a ruby process forks, its random
	  seed shall be reinitialized to prevent CVE-2003-0900 situation.
	  This bug affects for 1.8 and earlier series, but not for 1.9.
	  fixed [ruby-core:34944].

	* io.c (pipe_open): ditto.

	* random.c (rb_reset_random_seed): ditto.

	* intern.h (rb_reset_random_seed): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@31655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org>

git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@31713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
shyouhei committed May 23, 2011
1 parent ad71472 commit 17bff4c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
@@ -1,3 +1,16 @@
Sat May 21 05:43:03 2011 URABE Shyouhei <shyouhei@ruby-lang.org>

* eval.c (rb_thread_atfork): When a ruby process forks, its random
seed shall be reinitialized to prevent CVE-2003-0900 situation.
This bug affects for 1.8 and earlier series, but not for 1.9.
fixed [ruby-core:34944].

* io.c (pipe_open): ditto.

* random.c (rb_reset_random_seed): ditto.

* intern.h (rb_reset_random_seed): ditto.

Sat May 21 04:55:15 2011 Akinori MUSHA <knu@iDaemons.org>

* lib/uri/generic.rb (#route_from_path): Fix a bug where
Expand Down
1 change: 1 addition & 0 deletions eval.c
Expand Up @@ -13178,6 +13178,7 @@ rb_thread_atfork()
{
rb_thread_t th;

rb_reset_random_seed();
if (rb_thread_alone()) return;
FOREACH_THREAD(th) {
if (th != curr_thread) {
Expand Down
1 change: 1 addition & 0 deletions intern.h
Expand Up @@ -380,6 +380,7 @@ VALUE rb_length_by_each _((VALUE));
/* random.c */
unsigned long rb_genrand_int32(void);
double rb_genrand_real(void);
void rb_reset_random_seed(void);
/* re.c */
int rb_memcmp _((const void*,const void*,long));
int rb_memcicmp _((const void*,const void*,long));
Expand Down
1 change: 1 addition & 0 deletions io.c
Expand Up @@ -3254,6 +3254,7 @@ pipe_open(pstr, pname, mode)
rb_thread_stop_timer();
switch ((pid = fork())) {
case 0: /* child */
rb_thread_atfork();
if (modef & FMODE_READABLE) {
close(pr[0]);
if (pr[1] != 1) {
Expand Down
8 changes: 7 additions & 1 deletion random.c
Expand Up @@ -491,9 +491,15 @@ rb_f_rand(argc, argv, obj)
}

void
Init_Random()
rb_reset_random_seed()
{
rand_init(random_seed());
}

void
Init_Random()
{
rb_reset_random_seed();
rb_define_global_function("srand", rb_f_srand, -1);
rb_define_global_function("rand", rb_f_rand, -1);
rb_global_variable(&saved_seed);
Expand Down
8 changes: 4 additions & 4 deletions version.h
@@ -1,15 +1,15 @@
#define RUBY_VERSION "1.8.7"
#define RUBY_RELEASE_DATE "2011-05-21"
#define RUBY_RELEASE_DATE "2011-05-23"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20110521
#define RUBY_PATCHLEVEL 344
#define RUBY_RELEASE_CODE 20110523
#define RUBY_PATCHLEVEL 345

#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_YEAR 2011
#define RUBY_RELEASE_MONTH 5
#define RUBY_RELEASE_DAY 21
#define RUBY_RELEASE_DAY 23

#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];
Expand Down

0 comments on commit 17bff4c

Please sign in to comment.