aboutsummaryrefslogtreecommitdiffstats
path: root/ext/psych/psych_parser.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-10-18 12:34:59 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-11-12 10:35:47 +0900
commit30fdee65d96924e0793ec702fcda909a2cac71ea (patch)
tree9f92bbd2e5db5fc62fc85a5459de678eb66f56ae /ext/psych/psych_parser.c
parent5ef41c91f0a1bca1617aaa4367ccf8e32c04b2d9 (diff)
downloadruby-30fdee65d96924e0793ec702fcda909a2cac71ea.tar.gz
[ruby/psych] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous Ruby versions. I'm not sure if the untaint calls in deduplicate are still needed after the removal of tainting in the parser. If they are not needed, they should be removed. https://github.com/ruby/psych/commit/73c1a2b4e0
Diffstat (limited to 'ext/psych/psych_parser.c')
-rw-r--r--ext/psych/psych_parser.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/ext/psych/psych_parser.c b/ext/psych/psych_parser.c
index 0fef173729..fb1a917bb2 100644
--- a/ext/psych/psych_parser.c
+++ b/ext/psych/psych_parser.c
@@ -256,7 +256,6 @@ static VALUE parse(int argc, VALUE *argv, VALUE self)
yaml_parser_t * parser;
yaml_event_t event;
int done = 0;
- int tainted = 0;
int state = 0;
int parser_encoding = YAML_ANY_ENCODING;
int encoding = rb_utf8_encindex();
@@ -275,13 +274,10 @@ static VALUE parse(int argc, VALUE *argv, VALUE self)
yaml_parser_delete(parser);
yaml_parser_initialize(parser);
- if (OBJ_TAINTED(yaml)) tainted = 1;
-
if (rb_respond_to(yaml, id_read)) {
yaml = transcode_io(yaml, &parser_encoding);
yaml_parser_set_encoding(parser, parser_encoding);
yaml_parser_set_input(parser, io_reader, (void *)yaml);
- if (RTEST(rb_obj_is_kind_of(yaml, rb_cIO))) tainted = 1;
} else {
StringValue(yaml);
yaml = transcode_string(yaml, &parser_encoding);
@@ -352,13 +348,11 @@ static VALUE parse(int argc, VALUE *argv, VALUE self)
VALUE prefix = Qnil;
if(start->handle) {
handle = rb_str_new2((const char *)start->handle);
- if (tainted) OBJ_TAINT(handle);
PSYCH_TRANSCODE(handle, encoding, internal_enc);
}
if(start->prefix) {
prefix = rb_str_new2((const char *)start->prefix);
- if (tainted) OBJ_TAINT(prefix);
PSYCH_TRANSCODE(prefix, encoding, internal_enc);
}
@@ -387,7 +381,6 @@ static VALUE parse(int argc, VALUE *argv, VALUE self)
VALUE alias = Qnil;
if(event.data.alias.anchor) {
alias = rb_str_new2((const char *)event.data.alias.anchor);
- if (tainted) OBJ_TAINT(alias);
PSYCH_TRANSCODE(alias, encoding, internal_enc);
}
@@ -406,19 +399,16 @@ static VALUE parse(int argc, VALUE *argv, VALUE self)
(const char *)event.data.scalar.value,
(long)event.data.scalar.length
);
- if (tainted) OBJ_TAINT(val);
PSYCH_TRANSCODE(val, encoding, internal_enc);
if(event.data.scalar.anchor) {
anchor = rb_str_new2((const char *)event.data.scalar.anchor);
- if (tainted) OBJ_TAINT(anchor);
PSYCH_TRANSCODE(anchor, encoding, internal_enc);
}
if(event.data.scalar.tag) {
tag = rb_str_new2((const char *)event.data.scalar.tag);
- if (tainted) OBJ_TAINT(tag);
PSYCH_TRANSCODE(tag, encoding, internal_enc);
}
@@ -448,14 +438,12 @@ static VALUE parse(int argc, VALUE *argv, VALUE self)
VALUE implicit, style;
if(event.data.sequence_start.anchor) {
anchor = rb_str_new2((const char *)event.data.sequence_start.anchor);
- if (tainted) OBJ_TAINT(anchor);
PSYCH_TRANSCODE(anchor, encoding, internal_enc);
}
tag = Qnil;
if(event.data.sequence_start.tag) {
tag = rb_str_new2((const char *)event.data.sequence_start.tag);
- if (tainted) OBJ_TAINT(tag);
PSYCH_TRANSCODE(tag, encoding, internal_enc);
}
@@ -484,13 +472,11 @@ static VALUE parse(int argc, VALUE *argv, VALUE self)
VALUE implicit, style;
if(event.data.mapping_start.anchor) {
anchor = rb_str_new2((const char *)event.data.mapping_start.anchor);
- if (tainted) OBJ_TAINT(anchor);
PSYCH_TRANSCODE(anchor, encoding, internal_enc);
}
if(event.data.mapping_start.tag) {
tag = rb_str_new2((const char *)event.data.mapping_start.tag);
- if (tainted) OBJ_TAINT(tag);
PSYCH_TRANSCODE(tag, encoding, internal_enc);
}