File tree Expand file tree Collapse file tree 4 files changed +25
-5
lines changed Expand file tree Collapse file tree 4 files changed +25
-5
lines changed 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
+
1
6
Mon Aug 17 16:18:13 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
2
7
3
8
* 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
2091
2091
assert_equal("\x00\x00\xFE\xFF\x00\x00\x00t\x00\x00\x00e\x00\x00\x00s\x00\x00\x00t", result.b, bug)
2092
2092
end;
2093
2093
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
2094
2112
end
Original file line number Diff line number Diff line change @@ -372,15 +372,12 @@ load_transcoder_entry(transcoder_entry_t *entry)
372
372
char * const path = RSTRING_PTR (fn );
373
373
const int safe = rb_safe_level ();
374
374
375
- entry -> lib = NULL ;
376
-
377
375
memcpy (path , transcoder_lib_prefix , sizeof (transcoder_lib_prefix ) - 1 );
378
376
memcpy (path + sizeof (transcoder_lib_prefix ) - 1 , lib , len );
379
377
rb_str_set_len (fn , total_len );
380
378
FL_UNSET (fn , FL_TAINT );
381
379
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 );
384
381
}
385
382
386
383
if (entry -> transcoder )
Original file line number Diff line number Diff line change 1
1
#define RUBY_VERSION "2.1.7"
2
2
#define RUBY_RELEASE_DATE "2015-08-17"
3
- #define RUBY_PATCHLEVEL 381
3
+ #define RUBY_PATCHLEVEL 382
4
4
5
5
#define RUBY_RELEASE_YEAR 2015
6
6
#define RUBY_RELEASE_MONTH 8
You can’t perform that action at this time.
0 commit comments