diff --git a/ChangeLog b/ChangeLog index 32696cf9ed..9e34487b65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Fri Oct 19 22:11:55 2012 Benoit Daloze + + * pack.c (pack_unpack): set encoding of the + 'H','h','B' and 'B' modifiers to US-ASCII. + + * test/ruby/test_pack.rb: tests for the above. + [ruby-core:47653][Bug #7050] + + * test/test_securerandom.rb: tests for SecureRandom.hex + from tenderlove. [ruby-core:46792][Bug #6799] + Fri Oct 19 19:29:11 2012 Koichi Sasada * method.h (rb_method_cfunc_t::invoker): add new field (func ptr) diff --git a/pack.c b/pack.c index 06086ba2af..fabbb7ddb0 100644 --- a/pack.c +++ b/pack.c @@ -1459,7 +1459,7 @@ pack_unpack(VALUE str, VALUE fmt) if (p[-1] == '*' || len > (send - s) * 8) len = (send - s) * 8; bits = 0; - UNPACK_PUSH(bitstr = rb_str_new(0, len)); + UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len)); t = RSTRING_PTR(bitstr); for (i=0; i>= 1; @@ -1479,7 +1479,7 @@ pack_unpack(VALUE str, VALUE fmt) if (p[-1] == '*' || len > (send - s) * 8) len = (send - s) * 8; bits = 0; - UNPACK_PUSH(bitstr = rb_str_new(0, len)); + UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len)); t = RSTRING_PTR(bitstr); for (i=0; i (send - s) * 2) len = (send - s) * 2; bits = 0; - UNPACK_PUSH(bitstr = rb_str_new(0, len)); + UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len)); t = RSTRING_PTR(bitstr); for (i=0; i (send - s) * 2) len = (send - s) * 2; bits = 0; - UNPACK_PUSH(bitstr = rb_str_new(0, len)); + UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len)); t = RSTRING_PTR(bitstr); for (i=0; i