-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
DoS: Arithmetic Operation Causes 100% CPU Usage and Unbounded Virtual Memory Growth #135186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The problem is not that loop itself, is comparing the pointer not the values. |
I doubt it's a bug. You tried something like What you expect, computing enormous power with arbitrary precision arithmetic? @ZeroIntensity, could you argue your decisions? |
math.h pow() wouldnt do this ;) but being objects is logic, but maybe an exception |
math.h is not for arbitrary precision integer arithmetic. |
I didn't mean to remove
What exception do you expect? |
but with pow there is no error control and is keep allocating all the time |
|
in this way there is a ValueError, here there is a limit, in the other case not |
Because it's a much smaller operation. |
sure, well regards. |
But your problem is not the shift - it's power:
This message coming from limits in binary->decimal conversion of the output, not from computing of the power.
It's because limiting "other cases" will ruin sane computations of people. It's easy to estimate size of your power: >>> a = 241; b = 137; a = b << a
>>> a*math.log2(b) # bit length
3.4362715795059602e+75 Wikipedia knows something like the quettabyte - it's
No. Neither power has "digits limit", except from coming from hardware limitations (available memory, etc). You can read about integer conversion string limitations here: (BTW, I suspect this odd limit will produce new issues like that.) |
The Languages like nodejs or ruby answers But well, It makes sense not implementing power limits and don't limiting other more powerful hardwares, I close the ticket. thanks. |
Are you sure? Are you using big integers on whose languages or trying to compute floating-point powers?
Or reading of the documentation;-) |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
There is a bug in the
PyLongObject
implementation duringx_mul
operations with certain values, triggering a Denial of Service (DoS) by causing 100% CPU usage and unbounded virtual memory growth.First I triggered allocation errors in python3.10, and I also verified it with git version.
Reproducing the issue is simple, here I triggered it in latest git verision main branch:
With other operations I got a more convenient exceptions like:
But with this operation, the CPU starts consuming 100% and virtual memory keeps increasing.
paend pointer is expected that points after pa pointer.
And this causes a brk() syscall loop:
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: