Skip to content

Conversation

wshanks
Copy link
Collaborator

@wshanks wshanks commented Aug 29, 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

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 qiskit-community#1594
@wshanks wshanks requested a review from dcmckayibm August 29, 2025 18:24
@wshanks wshanks added the backport stable potential The issue or PR might be minimal and/or import enough to backport to stable label Aug 29, 2025
@dcmckayibm
Copy link
Collaborator

We tested this right? If so I'm good.

@wshanks wshanks added this pull request to the merge queue Sep 5, 2025
@wshanks
Copy link
Collaborator Author

wshanks commented Sep 5, 2025

Yes, I tested it just by doing StandardRB with Aer and 10,001 Cliffords.

Merged via the queue into qiskit-community:main with commit 643c20a Sep 5, 2025
11 checks passed
@wshanks wshanks deleted the rb-clifford-10k branch September 5, 2025 16:56
mergify bot pushed a commit that referenced this pull request 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

(cherry picked from commit 643c20a)
wshanks added a commit that referenced this pull request Sep 5, 2025
…1595) (#1597)

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
https://github.com/qiskit-community/qiskit-experiments/issues/1594<hr>This
is an automatic backport of pull request #1595 done by
[Mergify](https://mergify.com).

Co-authored-by: Will Shanks <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable potential The issue or PR might be minimal and/or import enough to backport to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RB analysis can not work beyond 10,000 Cliffords
2 participants