diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-12 02:44:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-12 02:44:27 +0000 |
commit | d7444332257a6fb255300ee938a20dfa64cccf32 (patch) | |
tree | 1e5d3ffdfdf32714f1fd21085eda79c0a2aa5799 /string.c | |
parent | 8cc3fef898e7e2edf2554c153318f6cc483a01f2 (diff) | |
download | ruby-d7444332257a6fb255300ee938a20dfa64cccf32.tar.gz |
rb_str_new_frozen: new object if tainted/untrusted unmatch
* string.c (rb_str_new_frozen): since the result object should have
same tainted/untrusted bits with the original object, return new
object if the shared object unmatch. [ruby-core:39745][Bug #5374]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -681,7 +681,7 @@ rb_str_new_frozen(VALUE orig) assert(OBJ_FROZEN(str)); ofs = RSTRING_LEN(str) - RSTRING_LEN(orig); if ((ofs > 0) || (klass != RBASIC(str)->klass) || - (!OBJ_TAINTED(str) && OBJ_TAINTED(orig)) || + ((RBASIC(str)->flags ^ RBASIC(orig)->flags) & (FL_TAINT|FL_UNTRUSTED)) || ENCODING_GET(str) != ENCODING_GET(orig)) { str = str_new3(klass, str); RSTRING(str)->as.heap.ptr += ofs; |