X-Git-Url: https://git.yukkurigames.com/?p=python-bulletml.git;a=blobdiff_plain;f=bulletml%2Fexpr.py;fp=bulletml%2Fexpr.py;h=c7d40983dd620d5fa961f7fb70b5b1e7111f456c;hp=385b31b5ab1d8fc1122d1f903f076a938876ba69;hb=1880336bb4dedf2261d8902070ee3f143718c8e4;hpb=9b9562e320203d99bf93594e4b1b429a813bb3e0 diff --git a/bulletml/expr.py b/bulletml/expr.py index 385b31b..c7d4098 100644 --- a/bulletml/expr.py +++ b/bulletml/expr.py @@ -38,6 +38,12 @@ class NumberDef(object): expr = expr.string except AttributeError: pass + try: + if "__" in expr: + # nedbatchelder.com/blog/201206/eval_really_is_dangerous.html + raise ExprError(expr) + except TypeError: + pass self.string = expr = str(expr) repl = lambda match: "params[%d]" % (int(match.group()[1:]) - 1) expr = re.sub(r"\$\d+", repl, expr.lower())