File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Mon Aug 17 16:22:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+ * transcode.c (load_transcoder_entry): fix transcoder loading race
4+ condition, by waiting in require. [ruby-dev:49106] [Bug #11277]
5+
16Mon Aug 17 16:18:13 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
27
38 * array.c (ary_ensure_room_for_push): check if array size will
Original file line number Diff line number Diff line change @@ -2091,4 +2091,22 @@ def test_valid_dummy_encoding
20912091 assert_equal("\x00\x00\xFE\xFF\x00\x00\x00t\x00\x00\x00e\x00\x00\x00s\x00\x00\x00t", result.b, bug)
20922092 end;
20932093 end
2094+
2095+ def test_loading_race
2096+ assert_separately ( [ ] , <<-'end;' ) #do
2097+ bug11277 = '[ruby-dev:49106] [Bug #11277]'
2098+ num = 2
2099+ th = (0...num).map do |i|
2100+ Thread.new {"\u3042".encode("EUC-JP")}
2101+ end
2102+ result = nil
2103+ assert_warning("", bug11277) do
2104+ assert_nothing_raised(Encoding::ConverterNotFoundError, bug11277) do
2105+ result = th.map(&:value)
2106+ end
2107+ end
2108+ expected = "\xa4\xa2".force_encoding(Encoding::EUC_JP)
2109+ assert_equal([expected]*num, result, bug11277)
2110+ end;
2111+ end
20942112end
Original file line number Diff line number Diff line change @@ -372,15 +372,12 @@ load_transcoder_entry(transcoder_entry_t *entry)
372372 char * const path = RSTRING_PTR (fn );
373373 const int safe = rb_safe_level ();
374374
375- entry -> lib = NULL ;
376-
377375 memcpy (path , transcoder_lib_prefix , sizeof (transcoder_lib_prefix ) - 1 );
378376 memcpy (path + sizeof (transcoder_lib_prefix ) - 1 , lib , len );
379377 rb_str_set_len (fn , total_len );
380378 FL_UNSET (fn , FL_TAINT );
381379 OBJ_FREEZE (fn );
382- if (!rb_require_safe (fn , safe > 3 ? 3 : safe ))
383- return NULL ;
380+ rb_require_safe (fn , safe > 3 ? 3 : safe );
384381 }
385382
386383 if (entry -> transcoder )
Original file line number Diff line number Diff line change 11#define RUBY_VERSION "2.1.7"
22#define RUBY_RELEASE_DATE "2015-08-17"
3- #define RUBY_PATCHLEVEL 381
3+ #define RUBY_PATCHLEVEL 382
44
55#define RUBY_RELEASE_YEAR 2015
66#define RUBY_RELEASE_MONTH 8
You can’t perform that action at this time.
0 commit comments