开发者

Is evaluating random text dangerous? [closed]

This question is unli开发者_运维技巧kely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

I've been passing time this afternoon by generating random strings and passing them through Perl's eval. The scripts are strings that contain only the following characters:

+-*$_.,/\@()%=`

Is there a statistically significant risk that I break something?

Note: I don't pass it arguments like "rm -rf /".


Statistically significant from a statistician's point of view, no. From a programmers point of view yes. Any percentage of risk that can be avoided is too much.


$! can resolve to a wide variety of strings, depending on platform and locale. So perhaps something like

eval "$!=$$/$.,`$!`"

has the potential for mischief.


My gut says that answering this question definitively (i.e., with an actual probability) would probably end up placing a bound on Chaitin's constant which is incomputable. So it's most likely not possible (mathematically speaking) to answer your question.

Why not just sandbox the Perl process if you're worried?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜