From: Andre' Date: 2004-08-12T00:21:12+09:00 Subject: Re: Thread takeover Thank you for the hints. >> But if I add the line "m = Main.new" at the end of 'p.rb', the thread >> seems to take over! (22222222222222222222222222222222222) > > That's probably a scoping issue; it might be that Main#initialize in p.rb > overwrites Main#initialize in your script file. I don't think so. If I change the name of the class in one of the classes, I still get the same problem. >> Since this 'p.rb' is some external file the users will input, I can't > tell >> what it'll be on it, so I can't avoid that a malicious code takes over > my >> program! Or can I? > > You can't if you simply require arbitrary code. The interpreter will > happily execute whatever he finds in p.rb. You can limit damage by > setting $SAFE in the thread loading the code plus taking some more > measures but I'm not sure whether you can really stop threads from > running > berserk. (I believe not.) I tried. Setting $SAFE higher will only disallow loading a file (which I can't) and it won't solve my problem. Andr� -- (c) Andre' - All rights reseved - 2004