diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | array.c | 2 |
2 files changed, 7 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Fri Jun 13 13:42:58 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * array.c (rb_ary_permutation): `p` is the array of size `r`, as + commented at permute0(). since `n >= r` here, buffer overflow + never happened, just reduce unnecessary allocation though. + Thu Jun 12 20:32:28 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> * string.c (rb_str_resize): should consider the capacity instead @@ -4858,7 +4858,7 @@ rb_ary_permutation(int argc, VALUE *argv, VALUE ary) } } else { /* this is the general case */ - volatile VALUE t0 = tmpbuf(n,sizeof(long)); + volatile VALUE t0 = tmpbuf(r,sizeof(long)); long *p = (long*)RSTRING_PTR(t0); volatile VALUE t1 = tmpbuf(n,sizeof(char)); char *used = (char*)RSTRING_PTR(t1); |