Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b4c5dd8

Browse files
committed
Merge pull request #17 from github/merge-upstream-2.1.2
Merge upstream 2.1.2
2 parents 215a869 + 9a21a49 commit b4c5dd8

32 files changed

+328
-73
lines changed

ChangeLog

+120-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,126 @@ Thu Mar 6 10:33:31 2014 Martin Bosslet <[email protected]>
1111
Reported by Jeff Hodges.
1212
[ruby-core:59829] [Bug #9424]
1313

14+
Thu May 8 01:13:10 2014 NARUSE, Yui <[email protected]>
15+
16+
* configure.in: correct pthread_setname_np's prototype on NetBSD.
17+
[Bug #9586]
18+
19+
Tue May 6 00:54:56 2014 Narihiro Nakamura <[email protected]>
20+
21+
* gc.c (gc_after_sweep): suppress unnecessary expanding heap.
22+
Tomb heap pages are freed pages here, so expanding heap is
23+
not required.
24+
25+
Mon May 5 02:35:20 2014 Nobuyoshi Nakada <[email protected]>
26+
27+
* ext/openssl/ossl_pkey.c (ossl_pkey_verify): as EVP_VerifyFinal()
28+
finalizes only a copy of the digest context, the context must be
29+
cleaned up after initialization by EVP_MD_CTX_cleanup() or a
30+
memory leak will occur. [ruby-core:62038] [Bug #9743]
31+
32+
Mon May 5 02:21:48 2014 Nobuyoshi Nakada <[email protected]>
33+
34+
* ext/dl/cptr.c (dlptr_free), ext/dl/handle.c (dlhandle_free),
35+
ext/fiddle/handle.c (fiddle_handle_free),
36+
ext/fiddle/pointer.c (fiddle_ptr_free): fix memory leak.
37+
based on the patch Heesob Park at [ruby-dev:48021] [Bug #9599].
38+
39+
Mon May 5 01:20:27 2014 Eric Wong <[email protected]>
40+
41+
* gc.c (rb_gc_writebarrier): drop special case for big hash/array
42+
[Bug #9518]
43+
44+
Mon May 5 01:13:00 2014 Koichi Sasada <[email protected]>
45+
46+
* gc.c (gc_before_sweep): cap `malloc_limit' to
47+
gc_params.malloc_limit_max. It can grow and grow with such case:
48+
`loop{"a" * (1024 ** 2)}'
49+
[Bug #9687]
50+
51+
This issue is pointed by Tim Robertson.
52+
http://www.omniref.com/blog/blog/2014/03/27/ruby-garbage-collection-still-not-ready-for-production/
53+
54+
Mon May 5 00:52:18 2014 Kenta Murata <[email protected]>
55+
56+
* ext/bigdecimal/bigdecimal.c (BigDecimal_initialize): Insert GC guard.
57+
58+
* ext/bigdecimal/bigdecimal.c (BigDecimal_global_new): ditto.
59+
60+
Mon May 5 00:42:35 2014 SHIBATA Hiroshi <[email protected]>
61+
62+
* ext/psych/psych.gemspec: update gemspec for psych-2.0.5
63+
64+
Mon May 5 00:42:35 2014 SHIBATA Hiroshi <[email protected]>
65+
66+
* ext/psych/lib/psych.rb: Merge psych-2.0.5. bump version to
67+
libyaml-0.1.6 for CVE-2014-2525.
68+
* ext/psych/yaml/config.h: ditto.
69+
* ext/psych/yaml/scanner.c: ditto.
70+
* ext/psych/yaml/yaml_private.h: ditto.
71+
72+
Mon May 5 00:35:20 2014 Aaron Patterson <[email protected]>
73+
74+
* ext/psych/lib/psych/visitors/yaml_tree.rb: support dumping Encoding
75+
objects.
76+
77+
* ext/psych/lib/psych/visitors/to_ruby.rb: support loading Encoding
78+
objects.
79+
80+
* test/psych/test_encoding.rb: add test
81+
82+
* ext/psych/lib/psych.rb: add version
83+
84+
Mon May 5 00:16:35 2014 SHIBATA Hiroshi <[email protected]>
85+
86+
* gc.c: Fix up default GC params by @csfrancis [fix GH-556]
87+
88+
Fri May 2 00:19:36 2014 Nobuyoshi Nakada <[email protected]>
89+
90+
* ext/openssl/ossl.c (ossl_make_error): check NULL for unknown
91+
error reasons with old OpenSSL, and insert a colon iff formatted
92+
message is not empty.
93+
94+
Thu May 1 20:56:56 2014 Nobuyoshi Nakada <[email protected]>
95+
96+
* ext/readline/extconf.rb (rl_hook_func_t): check pointer type.
97+
[ruby-dev:48089] [Bug #9702]
98+
99+
Thu May 1 20:47:08 2014 Nobuyoshi Nakada <[email protected]>
100+
101+
* ext/readline/extconf.rb: fix typo, `$defs` not `$DEFS`.
102+
[ruby-core:61756] [Bug #9578]
103+
104+
Thu May 1 20:47:08 2014 Nobuyoshi Nakada <[email protected]>
105+
106+
* ext/readline/extconf.rb (rl_hook_func_t): define as Function for
107+
very old readline versions. [ruby-core:61209] [Bug #9578]
108+
109+
Thu May 1 20:47:08 2014 Tanaka Akira <[email protected]>
110+
111+
* ext/readline/readline.c (Init_readline): Use rl_hook_func_t instead
112+
of Function to support readline-6.3. (rl_hook_func_t is available
113+
since readline-4.2.)
114+
Reported by Dmitry Medvinsky. [ruby-core:61141] [Bug #9578]
115+
116+
Sat Mar 1 21:00:27 2014 Marc-Andre Lafortune <[email protected]>
117+
118+
* proc.c: Having optional keyword arguments makes maximum arity +1,
119+
not unlimited [#8072]
120+
121+
Sat Mar 1 17:25:12 2014 Marc-Andre Lafortune <[email protected]>
122+
123+
* proc.c: Having any mandatory keyword argument increases min arity
124+
[#9299]
125+
126+
Mon Feb 24 14:56:41 2014 WATANABE Hirofumi <[email protected]>
127+
128+
* tool/make-snapshot: needs CXXFLAGS. [ruby-core:59393][Bug #9320]
129+
130+
Mon Feb 24 14:56:41 2014 NAKAMURA Usaku <[email protected]>
131+
132+
* tool/make-snapshot: support new version scheme.
133+
14134
Mon Feb 24 13:05:48 2014 Aaron Patterson <[email protected]>
15135

16136
* ext/psych/lib/psych.rb: New release of psych.
@@ -590,7 +710,6 @@ Thu Jan 9 08:21:00 2014 Aman Gupta <[email protected]>
590710
* test/net/imap/Makefile: add `make regen_certs` to automate this
591711
process.
592712

593-
>>>>>>> v2_1_1
594713
Thu Dec 26 03:28:11 2013 Koichi Sasada <[email protected]>
595714

596715
* vm_insnhelper.c (argument_error): insert dummy frame to make

configure.in

+30
Original file line numberDiff line numberDiff line change
@@ -2455,6 +2455,36 @@ if test x"$enable_pthread" = xyes; then
24552455
else
24562456
AC_CHECK_FUNCS(pthread_attr_init)
24572457
fi
2458+
if test "$ac_cv_func_pthread_setname_np" = yes; then
2459+
AC_CACHE_CHECK([arguments of pthread_setname_np], [rb_cv_func_pthread_setname_np_arguments],
2460+
[rb_cv_func_pthread_setname_np_arguments=
2461+
# Linux,AIX, (pthread_self(), name)
2462+
# NetBSD (pthread_self(), name, \"%s\")
2463+
# Darwin (name)
2464+
for mac in \
2465+
"(pthread_self(), name)" \
2466+
"(pthread_self(), name, \"%s\")" \
2467+
"(name)" \
2468+
; do
2469+
AC_TRY_COMPILE([
2470+
@%:@include <pthread.h>
2471+
@%:@ifdef HAVE_PTHREAD_NP_H
2472+
@%:@include <pthread_np.h>
2473+
@%:@endif
2474+
@%:@define SET_THREAD_NAME(name) pthread_setname_np${mac}
2475+
],
2476+
[if (SET_THREAD_NAME("conftest")) return 1;],
2477+
[rb_cv_func_pthread_setname_np_arguments="${mac}"
2478+
break])
2479+
done
2480+
]
2481+
)
2482+
if test -n "${rb_cv_func_pthread_setname_np_arguments}"; then
2483+
AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), pthread_setname_np${rb_cv_func_pthread_setname_np_arguments})
2484+
else
2485+
AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), (void)0)
2486+
fi
2487+
fi
24582488
fi
24592489
if test x"$ac_cv_header_ucontext_h" = xyes; then
24602490
if test x"$rb_with_pthread" = xyes; then

ext/bigdecimal/bigdecimal.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -2456,9 +2456,11 @@ static Real *BigDecimal_new(int argc, VALUE *argv);
24562456
static VALUE
24572457
BigDecimal_initialize(int argc, VALUE *argv, VALUE self)
24582458
{
2459+
ENTER(1);
24592460
Real *pv = rb_check_typeddata(self, &BigDecimal_data_type);
2460-
Real *x = BigDecimal_new(argc, argv);
2461+
Real *x;
24612462

2463+
GUARD_OBJ(x, BigDecimal_new(argc, argv));
24622464
if (ToValue(x)) {
24632465
pv = VpCopy(pv, x);
24642466
}
@@ -2539,7 +2541,10 @@ BigDecimal_new(int argc, VALUE *argv)
25392541
static VALUE
25402542
BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
25412543
{
2542-
Real *pv = BigDecimal_new(argc, argv);
2544+
ENTER(1);
2545+
Real *pv;
2546+
2547+
GUARD_OBJ(pv, BigDecimal_new(argc, argv));
25432548
if (ToValue(pv)) pv = VpCopy(NULL, pv);
25442549
pv->obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, pv);
25452550
return pv->obj;

ext/dl/cptr.c

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ dlptr_free(void *ptr)
4949
(*(data->free))(data->ptr);
5050
}
5151
}
52+
xfree(ptr);
5253
}
5354

5455
static size_t

ext/dl/handle.c

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ dlhandle_free(void *ptr)
3838
if( dlhandle->ptr && dlhandle->open && dlhandle->enable_close ){
3939
dlclose(dlhandle->ptr);
4040
}
41+
xfree(ptr);
4142
}
4243

4344
static size_t

ext/fiddle/handle.c

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ fiddle_handle_free(void *ptr)
4040
if( fiddle_handle->ptr && fiddle_handle->open && fiddle_handle->enable_close ){
4141
dlclose(fiddle_handle->ptr);
4242
}
43+
xfree(ptr);
4344
}
4445

4546
static size_t

ext/fiddle/pointer.c

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ fiddle_ptr_free(void *ptr)
5656
(*(data->free))(data->ptr);
5757
}
5858
}
59+
xfree(ptr);
5960
}
6061

6162
static size_t

ext/openssl/ossl.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,11 @@ ossl_make_error(VALUE exc, const char *fmt, va_list args)
311311
else
312312
msg = ERR_reason_error_string(e);
313313
if (NIL_P(str)) {
314-
str = rb_str_new_cstr(msg);
314+
if (msg) str = rb_str_new_cstr(msg);
315315
}
316316
else {
317-
rb_str_cat2(rb_str_cat2(str, ": "), msg);
317+
if (RSTRING_LEN(str)) rb_str_cat2(str, ": ");
318+
rb_str_cat2(str, msg ? msg : "(null)");
318319
}
319320
}
320321
if (dOSSL == Qtrue){ /* show all errors on the stack */

ext/openssl/ossl_pkey.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,16 @@ ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data)
318318
{
319319
EVP_PKEY *pkey;
320320
EVP_MD_CTX ctx;
321+
int result;
321322

322323
GetPKey(self, pkey);
323-
EVP_VerifyInit(&ctx, GetDigestPtr(digest));
324324
StringValue(sig);
325325
StringValue(data);
326+
EVP_VerifyInit(&ctx, GetDigestPtr(digest));
326327
EVP_VerifyUpdate(&ctx, RSTRING_PTR(data), RSTRING_LEN(data));
327-
switch (EVP_VerifyFinal(&ctx, (unsigned char *)RSTRING_PTR(sig), RSTRING_LENINT(sig), pkey)) {
328+
result = EVP_VerifyFinal(&ctx, (unsigned char *)RSTRING_PTR(sig), RSTRING_LENINT(sig), pkey);
329+
EVP_MD_CTX_cleanup(&ctx);
330+
switch (result) {
328331
case 0:
329332
return Qfalse;
330333
case 1:

ext/psych/lib/psych.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#
2222
# Psych is a YAML parser and emitter.
2323
# Psych leverages libyaml [Home page: http://pyyaml.org/wiki/LibYAML]
24-
# or [Git repo: https://github.com/zerotao/libyaml] for its YAML parsing
24+
# or [HG repo: https://bitbucket.org/xi/libyaml] for its YAML parsing
2525
# and emitting capabilities. In addition to wrapping libyaml, Psych also
2626
# knows how to serialize and de-serialize most Ruby objects to and from
2727
# the YAML format.
@@ -217,7 +217,7 @@
217217

218218
module Psych
219219
# The version is Psych you're using
220-
VERSION = '2.0.3'
220+
VERSION = '2.0.5'
221221

222222
# The version of libyaml Psych is using
223223
LIBYAML_VERSION = Psych.libyaml_version.join '.'

ext/psych/lib/psych/visitors/to_ruby.rb

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def deserialize o
7575
class_loader.date_time
7676
require 'date'
7777
@ss.parse_time(o.value).to_datetime
78+
when '!ruby/encoding'
79+
::Encoding.find o.value
7880
when "!ruby/object:Complex"
7981
class_loader.complex
8082
Complex(o.value)

ext/psych/lib/psych/visitors/yaml_tree.rb

+5
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ def visit_Psych_Omap o
157157
@emitter.end_sequence
158158
end
159159

160+
def visit_Encoding o
161+
tag = "!ruby/encoding"
162+
@emitter.scalar o.name, nil, tag, false, false, Nodes::Scalar::ANY
163+
end
164+
160165
def visit_Object o
161166
tag = Psych.dump_tags[o.class]
162167
unless tag

ext/psych/psych.gemspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
Gem::Specification.new do |s|
44
s.name = "psych"
5-
s.version = "2.0.3"
5+
s.version = "2.0.5"
66

77
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
88
s.require_paths = ["lib"]
99
s.authors = ["Aaron Patterson"]
10-
s.date = "2014-02-04"
10+
s.date = "2014-03-27"
1111
s.description = "Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]\nfor its YAML parsing and emitting capabilities. In addition to wrapping\nlibyaml, Psych also knows how to serialize and de-serialize most Ruby objects\nto and from the YAML format."
1212
s.email = ["[email protected]"]
1313
s.extensions = ["ext/psych/extconf.rb"]
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
1717
s.rdoc_options = ["--main", "README.rdoc"]
1818
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
1919
s.rubyforge_project = "psych"
20-
s.rubygems_version = "2.2.1"
20+
s.rubygems_version = "2.2.2"
2121
s.summary = "Psych is a YAML parser and emitter"
2222
s.test_files = ["test/psych/handlers/test_recorder.rb", "test/psych/json/test_stream.rb", "test/psych/nodes/test_enumerable.rb", "test/psych/test_alias_and_anchor.rb", "test/psych/test_array.rb", "test/psych/test_boolean.rb", "test/psych/test_class.rb", "test/psych/test_coder.rb", "test/psych/test_date_time.rb", "test/psych/test_deprecated.rb", "test/psych/test_document.rb", "test/psych/test_emitter.rb", "test/psych/test_encoding.rb", "test/psych/test_engine_manager.rb", "test/psych/test_exception.rb", "test/psych/test_hash.rb", "test/psych/test_json_tree.rb", "test/psych/test_merge_keys.rb", "test/psych/test_nil.rb", "test/psych/test_null.rb", "test/psych/test_numeric.rb", "test/psych/test_object.rb", "test/psych/test_object_references.rb", "test/psych/test_omap.rb", "test/psych/test_parser.rb", "test/psych/test_psych.rb", "test/psych/test_safe_load.rb", "test/psych/test_scalar.rb", "test/psych/test_scalar_scanner.rb", "test/psych/test_serialize_subclasses.rb", "test/psych/test_set.rb", "test/psych/test_stream.rb", "test/psych/test_string.rb", "test/psych/test_struct.rb", "test/psych/test_symbol.rb", "test/psych/test_tainted.rb", "test/psych/test_to_yaml_properties.rb", "test/psych/test_tree_builder.rb", "test/psych/test_yaml.rb", "test/psych/test_yamldbm.rb", "test/psych/test_yamlstore.rb", "test/psych/visitors/test_depth_first.rb", "test/psych/visitors/test_emitter.rb", "test/psych/visitors/test_to_ruby.rb", "test/psych/visitors/test_yaml_tree.rb"]
2323
end

ext/psych/yaml/config.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
21
#define PACKAGE_NAME "yaml"
32
#define PACKAGE_TARNAME "yaml"
4-
#define PACKAGE_VERSION "0.1.5"
5-
#define PACKAGE_STRING "yaml 0.1.5"
3+
#define PACKAGE_VERSION "0.1.6"
4+
#define PACKAGE_STRING "yaml 0.1.6"
65
#define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component libyaml"
76
#define PACKAGE_URL ""
87
#define YAML_VERSION_MAJOR 0
98
#define YAML_VERSION_MINOR 1
10-
#define YAML_VERSION_PATCH 5
11-
#define YAML_VERSION_STRING "0.1.5"
9+
#define YAML_VERSION_PATCH 6
10+
#define YAML_VERSION_STRING "0.1.6"

ext/psych/yaml/scanner.c

+3
Original file line numberDiff line numberDiff line change
@@ -2629,6 +2629,9 @@ yaml_parser_scan_tag_uri(yaml_parser_t *parser, int directive,
26292629
/* Check if it is a URI-escape sequence. */
26302630

26312631
if (CHECK(parser->buffer, '%')) {
2632+
if (!STRING_EXTEND(parser, string))
2633+
goto error;
2634+
26322635
if (!yaml_parser_scan_uri_escapes(parser,
26332636
directive, start_mark, &string)) goto error;
26342637
}

ext/psych/yaml/yaml_private.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,12 @@ yaml_string_join(
146146
(string).start = (string).pointer = (string).end = 0)
147147

148148
#define STRING_EXTEND(context,string) \
149-
(((string).pointer+5 < (string).end) \
149+
((((string).pointer+5 < (string).end) \
150150
|| yaml_string_extend(&(string).start, \
151-
&(string).pointer, &(string).end))
151+
&(string).pointer, &(string).end)) ? \
152+
1 : \
153+
((context)->error = YAML_MEMORY_ERROR, \
154+
0))
152155

153156
#define CLEAR(context,string) \
154157
((string).pointer = (string).start, \

ext/readline/extconf.rb

-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ def readline.have_type(type)
9999
readline.have_func("rl_insert_text")
100100
readline.have_func("rl_delete_text")
101101
unless readline.have_type("rl_hook_func_t*")
102-
# rl_hook_func_t is available since readline-4.2 (2001).
103-
# Function is removed at readline-6.3 (2014).
104-
# However, editline (NetBSD 6.1.3, 2014) doesn't have rl_hook_func_t.
105102
$defs << "-Drl_hook_func_t=Function"
106103
end
107104

0 commit comments

Comments
 (0)