Skip to content

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Sep 5, 2025

lmfit (through its asteval dependnecy) limits exponentiation in its expression models to 10,000. The limit is there to avoid denial of service attacks where user input could be substituted into a model and Python integers which are unbounded and could take up exponential amounts of memory. In qiskit-experiments, this case is not a concern. The workaround implemented here is to divide the exponential in the curve by 10 and then exponentiate the result by 10. This change allows up to 100,000 Cliffords which should be enough. The alternative workaround is to change asteval.astutils.MAX_EXPONENT to a sufficiently large value.

Closes #1594


This is an automatic backport of pull request #1595 done by Mergify.

lmfit (through its asteval dependnecy) limits exponentiation in its
expression models to 10,000. The limit is there to avoid denial of
service attacks where user input could be substituted into a model and
Python integers which are unbounded and could take up exponential
amounts of memory. In qiskit-experiments, this case is not a concern.
The workaround implemented here is to divide the exponential in the
curve by 10 and then exponentiate the result by 10. This change allows
up to 100,000 Cliffords which should be enough. The alternative
workaround is to change `asteval.astutils.MAX_EXPONENT` to a
sufficiently large value.

Closes
#1594

(cherry picked from commit 643c20a)
@wshanks wshanks merged commit b32c462 into stable/0.12 Sep 5, 2025
11 checks passed
@wshanks wshanks deleted the mergify/bp/stable/0.12/pr-1595 branch September 5, 2025 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant