diff --git a/ChangeLog b/ChangeLog index 9f4fedef2c..50ff5af980 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Jul 13 23:02:36 2014 Nobuyoshi Nakada + + * 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. + Sun Jul 13 22:52:43 2014 Nobuyoshi Nakada * pack.c (encodes): fix buffer overrun by tail_lf. Thanks to diff --git a/array.c b/array.c index a57733866e..425cff20ad 100644 --- a/array.c +++ b/array.c @@ -4818,7 +4818,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); diff --git a/version.h b/version.h index 2192725495..22ed42eaf8 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.2" #define RUBY_RELEASE_DATE "2014-07-13" -#define RUBY_PATCHLEVEL 171 +#define RUBY_PATCHLEVEL 172 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 7