File tree Expand file tree Collapse file tree 4 files changed +40
-9
lines changed Expand file tree Collapse file tree 4 files changed +40
-9
lines changed Original file line number Diff line number Diff line change
1
+ Fri Oct 12 12:25:15 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
2
+
3
+ * error.c (name_err_to_s): we need not infect msg.
4
+
5
+ * test/ruby/test_exception.rb (TestException#test_exception_to_s_should_not_propagate_untrustedness): test for it.
6
+
1
7
Fri Jun 29 21:26:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
2
8
3
9
* eval.c (stack_extend): prevent ALLOCA_N, which reserves a memory
Original file line number Diff line number Diff line change @@ -665,9 +665,6 @@ name_err_to_s(exc)
665
665
666
666
if (NIL_P (mesg )) return rb_class_name (CLASS_OF (exc ));
667
667
StringValue (str );
668
- if (str != mesg ) {
669
- OBJ_INFECT (str , mesg );
670
- }
671
668
return str ;
672
669
}
673
670
Original file line number Diff line number Diff line change @@ -204,6 +204,34 @@ def o.to_str
204
204
o . taint
205
205
e = NameError . new ( o )
206
206
s = e . to_s
207
- assert_equal ( true , s . tainted? )
207
+ assert_equal ( false , s . tainted? )
208
+ end
209
+
210
+ def test_exception_to_s_should_not_propagate_untrustedness
211
+ favorite_lang = "Ruby"
212
+
213
+ for exc in [ Exception , NameError ]
214
+ assert_raise ( SecurityError ) do
215
+ lambda {
216
+ $SAFE = 4
217
+ exc . new ( favorite_lang ) . to_s
218
+ favorite_lang . replace ( "Python" )
219
+ } . call
220
+ end
221
+ end
222
+
223
+ assert_raise ( SecurityError ) do
224
+ lambda {
225
+ $SAFE = 4
226
+ o = Object . new
227
+ ( class << o ; self ; end ) . send ( :define_method , :to_str ) {
228
+ favorite_lang
229
+ }
230
+ NameError . new ( o ) . to_s
231
+ favorite_lang . replace ( "Python" )
232
+ } . call
233
+ end
234
+
235
+ assert_equal ( "Ruby" , favorite_lang )
208
236
end
209
237
end
Original file line number Diff line number Diff line change 1
1
#define RUBY_VERSION "1.8.7"
2
- #define RUBY_RELEASE_DATE "2012-06-29 "
2
+ #define RUBY_RELEASE_DATE "2012-10-12 "
3
3
#define RUBY_VERSION_CODE 187
4
- #define RUBY_RELEASE_CODE 20120629
5
- #define RUBY_PATCHLEVEL 370
4
+ #define RUBY_RELEASE_CODE 20121012
5
+ #define RUBY_PATCHLEVEL 371
6
6
7
7
#define RUBY_VERSION_MAJOR 1
8
8
#define RUBY_VERSION_MINOR 8
9
9
#define RUBY_VERSION_TEENY 7
10
10
#define RUBY_RELEASE_YEAR 2012
11
- #define RUBY_RELEASE_MONTH 6
12
- #define RUBY_RELEASE_DAY 29
11
+ #define RUBY_RELEASE_MONTH 10
12
+ #define RUBY_RELEASE_DAY 12
13
13
14
14
#ifdef RUBY_EXTERN
15
15
RUBY_EXTERN const char ruby_version [];
You can’t perform that action at this time.
0 commit comments