mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +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(kw)
|
||||
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"):
|
||||
args[k] = _Operand(v)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user