You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve size validation in _Py_DecodeUTF8Ex #91421
The size check in _Py_DecodeUTF8Ex can be improved to always check against a constant value without further arithmetic involved. This is already done at other places within the file, e.g. here.
I was curious if this could actually be triggered with a proof of concept by overflowing the check and eventually performing an out of boundary heap access. And in fact, with a very artificial setup, it is possible on a 32 bit system which tries to convert a 2 GB long string:
I doubt that this is really reachable with actual code. But at least it is a good showcase that actual arithmetic is left over in the if-check. Let's remove it and save us this possible headache.
PS: Not sure if this is the correct way to create python issues with GitHub now. Let me know if something's missing or wrong!
Activity
pythongh-91421: Use constant value check during runtime (pythonGH-91422)
gh-91421: Use constant value check during runtime (GH-91422) (GH-91492)
gh-91421: Use constant value check during runtime (GH-91422) (GH-91493)
pythongh-91421: Use constant value check during runtime (pythonGH-91422…
pythongh-91421: Use constant value check during runtime (pythonGH-91422)