[macruby-changes] [153] MacRuby/trunk/string.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 18 00:52:56 PDT 2008


Revision: 153
          http://trac.macosforge.org/projects/ruby/changeset/153
Author:   lsansonetti at apple.com
Date:     2008-04-18 00:52:56 -0700 (Fri, 18 Apr 2008)

Log Message:
-----------
transfert taint state during #sub/#gsub

Modified Paths:
--------------
    MacRuby/trunk/string.c

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2008-04-18 03:48:17 UTC (rev 152)
+++ MacRuby/trunk/string.c	2008-04-18 07:52:56 UTC (rev 153)
@@ -3707,7 +3707,7 @@
 	if (NIL_P(hash)) {
 	    StringValue(repl);
 	}
-	if (OBJ_TAINTED(repl)) tainted = 1;
+	if (rb_obj_tainted(repl) == Qtrue) tainted = 1;
 	break;
       default:
 	rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
@@ -3761,7 +3761,7 @@
 	    val = rb_reg_regsub(repl, str, regs, pat);
 	}
 
-	if (OBJ_TAINTED(val)) tainted = 1;
+	if (rb_obj_tainted(val) == Qtrue) tainted = 1;
 
 	len = beg - offset;	/* copy pre-match substr */
         if (len) {
@@ -3794,6 +3794,8 @@
 	CFStringReplaceAll((CFMutableStringRef)str, (CFStringRef)dest);
     }
     else {
+    	if (!tainted && rb_str_tainted(str) == Qtrue)
+	    tainted = 1;
 	str = dest;
     }
 #else
@@ -3808,7 +3810,7 @@
     }
 #endif
 
-    if (tainted) OBJ_TAINT(str);
+    if (tainted) rb_str_taint(str);
     return str;
 }
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080418/ebd6a937/attachment.html


More information about the macruby-changes mailing list