ruby-changes:32116
From: nobu <ko1@a...>
Date: Sat, 14 Dec 2013 11:45:14 +0900 (JST)
Subject: [ruby-changes:32116] nobu:r44195 (trunk): util.c: bump stack size in ruby_qsort()
nobu 2013-12-14 11:45:07 +0900 (Sat, 14 Dec 2013) New Revision: 44195 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44195 Log: util.c: bump stack size in ruby_qsort() * 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] Modified files: trunk/ChangeLog trunk/util.c Index: ChangeLog =================================================================== --- ChangeLog (revision 44194) +++ ChangeLog (revision 44195) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Dec 14 11:44:52 2013 Nobuyoshi Nakada <nobu@r...> + + * 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] + Sat Dec 14 11:25:56 2013 Nobuyoshi Nakada <nobu@r...> * object.c (rb_mod_const_defined): support nested class path as Index: util.c =================================================================== --- util.c (revision 44194) +++ util.c (revision 44195) @@ -310,7 +310,9 @@ ruby_qsort(void* base, const size_t nel, https://github.com/ruby/ruby/blob/trunk/util.c#L310 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/