merge revision(s) 44195: [Backport #7772]

* util.c (ruby_qsort): fix potential stack overflow on a large
	  machine.  based on the patch by Conrad Irwin <conrad.irwin AT
	  gmail.com> at [ruby-core:51816].  [Bug #7772]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-01-12 06:53:41 +00:00
parent 9a1728a145
commit 0c44d66162
3 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Sun Jan 12 15:33:11 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* util.c (ruby_qsort): fix potential stack overflow on a large
machine. based on the patch by Conrad Irwin <conrad.irwin AT
gmail.com> at [ruby-core:51816]. [Bug #7772]
Sun Jan 12 15:17:00 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/tk/tkutil/tkutil.c: use rb_sprintf(), rb_id2str(), and

4
util.c
View file

@ -309,7 +309,9 @@ ruby_qsort(void* base, const size_t nel, const size_t size, cmpfunc_t *cmp, void
char *L = base; /* left end of current region */
char *R = (char*)base + size*(nel-1); /* right end of current region */
size_t chklim = 63; /* threshold of ordering element check */
stack_node stack[32], *top = stack; /* 32 is enough for 32bit CPU */
enum {size_bits = sizeof(size) * CHAR_BIT};
stack_node stack[size_bits]; /* enough for size_t size */
stack_node *top = stack;
int mmkind;
size_t high, low, n;

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2014-01-12"
#define RUBY_PATCHLEVEL 379
#define RUBY_PATCHLEVEL 380
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 1