From 50864b9d019e2dfd5fb43c5e4ea50917ba2d3f4a Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 29 Mar 2016 17:22:04 +0000 Subject: merge revision(s) 54256,54291,54292,54293: [Backport #12118] [Bug #12218] * thread_pthread.c (reserve_stack): fix reserving position where the stack growing bottom to top. [Bug #12118] * localeinit.c (rb_locale_charmap_index): fix prototype. patched by Andreas Schwab [Bug #12218] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 10 ++++++++++ localeinit.c | 2 +- thread_pthread.c | 26 ++++++++++++++++++++------ version.h | 2 +- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 543e2bbeec..6c70385595 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Wed Mar 30 02:20:06 2016 NARUSE, Yui + + * localeinit.c (rb_locale_charmap_index): fix prototype. + patched by Andreas Schwab [Bug #12218] + +Wed Mar 30 02:20:06 2016 NARUSE, Yui + + * thread_pthread.c (reserve_stack): fix reserving position where + the stack growing bottom to top. [Bug #12118] + Wed Mar 30 02:17:33 2016 Nobuyoshi Nakada * win32/file.c (rb_readlink): drop garbage after the substitute diff --git a/localeinit.c b/localeinit.c index c4dda819b7..6563a6f90a 100644 --- a/localeinit.c +++ b/localeinit.c @@ -89,7 +89,7 @@ enc_find_index(const char *name) } int -rb_locale_charmap_index(VALUE klass) +rb_locale_charmap_index(void) { return (int)locale_charmap(enc_find_index); } diff --git a/thread_pthread.c b/thread_pthread.c index 767805119d..1acd56c357 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -693,17 +693,31 @@ reserve_stack(volatile char *limit, size_t size) const volatile char *end = buf + sizeof(buf); limit += size; if (limit > end) { - size = limit - end; - limit = alloca(size); - limit[stack_check_margin+size-1] = 0; + /* |<-bottom (=limit(a)) top->| + * | .. |<-buf 256B |<-end | stack check | + * | 256B | =size= | margin (4KB)| + * | =size= limit(b)->| 256B | | + * | | alloca(sz) | | | + * | .. |<-buf |<-limit(c) [sz-1]->0> | | + */ + size_t sz = limit - end; + limit = alloca(sz); + limit[sz-1] = 0; } } else { limit -= size; if (buf > limit) { - limit = alloca(buf - limit); - limit[0] = 0; /* ensure alloca is called */ - limit -= stack_check_margin; + /* |<-top (=limit(a)) bottom->| + * | .. | 256B buf->| | stack check | + * | 256B | =size= | margin (4KB)| + * | =size= limit(b)->| 256B | | + * | | alloca(sz) | | | + * | .. | buf->| limit(c)-><0> | | + */ + size_t sz = buf - limit; + limit = alloca(sz); + limit[0] = 0; } } } diff --git a/version.h b/version.h index 52ee2b80c0..9084464c6f 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.3.0" #define RUBY_RELEASE_DATE "2016-03-30" -#define RUBY_PATCHLEVEL 69 +#define RUBY_PATCHLEVEL 70 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 3 -- cgit v1.2.3