PIL.ImageMath.eval in Pillow before 9.0.0 allows evaluation of arbitrary expressions, such as ones that use the Python exec method. A lambda expression could also be used.
{
"versions": [
{
"introduced": "0"
},
{
"fixed": "9.0.1"
},
{
"introduced": "0"
},
{
"last_affected": "9.0"
},
{
"introduced": "0"
},
{
"last_affected": "10.0"
},
{
"introduced": "0"
},
{
"last_affected": "11.0"
}
]
}