summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-08 17:13:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-08 17:13:55 +0000
commitcc1910b542ad5daf74df11cb87017ad9f1667bba (patch)
treed6fc507cef396b65a7d15e9245c316cd404d4e87 /include
parent85b1671b4257332ade223d9e167cea0bf0d40fdf (diff)
marshal.c: Numerics are not tainted
* include/ruby/ruby.h (OBJ_TAINTABLE, OBJ_TAINT, OBJ_INFECT), marshal.c (r_entry0): all Numerics never be tainted now. [ruby-core:57346] [Bug #8945] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r--include/ruby/ruby.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 6c6cee2..f6bee00 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -1175,14 +1175,14 @@ struct RBignum {
#define FL_UNSET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags &= ~(f);} while (0)
#define FL_REVERSE(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags ^= (f);} while (0)
+#define OBJ_TAINTABLE(x) (FL_ABLE(x) && BUILTIN_TYPE(x) != T_BIGNUM && BUILTIN_TYPE(x) != T_FLOAT)
#define OBJ_TAINTED(x) (!!FL_TEST((x), FL_TAINT))
-#define OBJ_TAINT(x) FL_SET((x), FL_TAINT)
+#define OBJ_TAINT(x) (OBJ_TAINTABLE(x) ? (RBASIC(x)->flags |= FL_TAINT) : 0)
#define OBJ_UNTRUSTED(x) OBJ_TAINTED(x)
#define OBJ_UNTRUST(x) OBJ_TAINT(x)
-#define OBJ_INFECT(x,s) do { \
- if (FL_ABLE(x) && FL_ABLE(s)) \
- RBASIC(x)->flags |= RBASIC(s)->flags & FL_TAINT; \
-} while (0)
+#define OBJ_INFECT(x,s) ( \
+ (OBJ_TAINTABLE(x) && FL_ABLE(s)) ? \
+ RBASIC(x)->flags |= RBASIC(s)->flags & FL_TAINT : 0)
#define OBJ_FROZEN(x) (!!(FL_ABLE(x)?(RBASIC(x)->flags&(FL_FREEZE)):(FIXNUM_P(x)||FLONUM_P(x)||SYMBOL_P(x))))
#define OBJ_FREEZE(x) FL_SET((x), FL_FREEZE)