diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-12-21 09:23:28 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-12-21 09:23:28 +0000 |
commit | 724b4e38b39a53602aea57b6bf63033f5bdd7278 (patch) | |
tree | f8118586a62a230db5e7a53998ec7c8775b78eac /re.c | |
parent | f4b24c219b149c8b202035ccba19cfa5341c8002 (diff) | |
download | ruby-724b4e38b39a53602aea57b6bf63033f5bdd7278.tar.gz ruby-724b4e38b39a53602aea57b6bf63033f5bdd7278.tar.xz ruby-724b4e38b39a53602aea57b6bf63033f5bdd7278.zip |
* time.c (time_plus): result should not be negative unless
NEGATIVE_TIME_T is defined.
* time.c (time_new_internal): should check tv_sec overflow too.
* time.c (time_timeval): should check time_t range when time is
initialized from float.
* time.c (time_plus): uses modf(3).
* variable.c (rb_cvar_set): add frozen class/module check.
* variable.c (rb_cvar_declare): add frozen class/module check.
* re.c (match_to_a): should propagate taint.
* re.c (rb_reg_s_quote): ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -781,11 +781,16 @@ match_to_a(match) VALUE ary = rb_ary_new2(regs->num_regs); char *ptr = RSTRING(RMATCH(match)->str)->ptr; int i; - + int taint = OBJ_TAINTED(match); + for (i=0; i<regs->num_regs; i++) { - if (regs->beg[i] == -1) rb_ary_push(ary, Qnil); - else rb_ary_push(ary, rb_str_new(ptr+regs->beg[i], - regs->end[i]-regs->beg[i])); + if (regs->beg[i] == -1) { + rb_ary_push(ary, Qnil); + } else { + VALUE str = rb_str_new(ptr+regs->beg[i], regs->end[i]-regs->beg[i]); + if (taint) OBJ_TAINT(str); + rb_ary_push(ary, str); + } } return ary; } @@ -1122,7 +1127,7 @@ rb_reg_s_quote(argc, argv) } kcode_reset_option(); rb_str_resize(tmp, t - RSTRING(tmp)->ptr); - + OBJ_INFECT(tmp, str); return tmp; } |