mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
Don't allow __ or builtins in env dictionarys for ImageMath.eval
This commit is contained in:
parent
c3af2643dd
commit
45c726fd4d
|
@ -237,6 +237,10 @@ def eval(expression, _dict={}, **kw):
|
||||||
args.update(_dict)
|
args.update(_dict)
|
||||||
args.update(kw)
|
args.update(kw)
|
||||||
for k, v in args.items():
|
for k, v in args.items():
|
||||||
|
if '__' in k or hasattr(__builtins__, k):
|
||||||
|
msg = f"'{k}' not allowed"
|
||||||
|
raise ValueError(msg)
|
||||||
|
|
||||||
if hasattr(v, "im"):
|
if hasattr(v, "im"):
|
||||||
args[k] = _Operand(v)
|
args[k] = _Operand(v)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user