summaryrefslogtreecommitdiffstats
path: root/thread.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-20 02:46:17 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-20 02:46:17 +0000
commitaba22072c085e158ea7497ffcc521467ee1c75ac (patch)
tree848a727b1a400b56d7906f33ad564d8073aaf693 /thread.c
parent95641468fff6718d773589fa78ec7a744fd652c5 (diff)
downloadruby-aba22072c085e158ea7497ffcc521467ee1c75ac.tar.gz
ruby-aba22072c085e158ea7497ffcc521467ee1c75ac.tar.xz
ruby-aba22072c085e158ea7497ffcc521467ee1c75ac.zip
* string.c (rb_memhash): randomize hash to avoid algorithmic
complexity attacks. (rb_str_hash): use rb_memhash. * include/ruby/intern.h (rb_reset_random_seed): declared. * thread.c (rb_thread_atfork): call rb_reset_random_seed. * inits.c (rb_call_inits): call Init_RandomSeed at first. * random.c (seed_initialized): defined. (fill_random_seed): extracted from random_seed. (make_seed_value): extracted from random_seed. (rb_f_rand): initialize random seed at first. (initial_seed): defined. (Init_RandomSeed): defined. (Init_RandomSeed2): defined. (rb_reset_random_seed): defined. (Init_Random): call Init_RandomSeed2. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index 92f5104db..13630b6b0 100644
--- a/thread.c
+++ b/thread.c
@@ -2124,6 +2124,7 @@ rb_thread_atfork(void)
st_clear(vm->living_threads);
st_insert(vm->living_threads, thval, (st_data_t) th->thread_id);
vm->sleeper = 0;
+ rb_reset_random_seed();
}
static int