| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…aching the thread state `hashlib_openssl_HMAC_update_once()` set an exception when the OpenSSL HMAC update function failed, but it was called inside a GIL-released region, with the object's mutex held, by `_hashlib.HMAC.update()` and `_hashlib.hmac_new()` when the data exceeds HASHLIB_GIL_MINSIZE bytes. Setting the exception with the thread state detached crashed the interpreter instead of raising an exception. Remove that helper, call the OpenSSL HMAC update function directly in `_hmac_update()`, and set the exception once the thread state is re-attached and the mutex is released, as it was done before pythongh-134531. The OpenSSL error queue is per thread, so the exception type and message are unaffected.
| Back | FazBrowse Home | New Git URL |
hashlib_openssl_HMAC_update_once() set an exception when the OpenSSL HMAC update function failed, but it was called inside a GIL-released region, with the object's mutex held, by _hashlib.HMAC.update() and _hashlib.hmac_new() when the data exceeds HASHLIB_GIL_MINSIZE bytes. Setting the exception with the thread state detached crashes the interpreter instead of raising an exception.
Remove that helper, call the OpenSSL HMAC update function directly in _hmac_update(), and set the exception once the thread state is re-attached and the mutex is released, as it was done before gh-134531. The OpenSSL error queue is per thread, so the exception type and message are unaffected.
This regression was introduced by gh-134531, so only 3.15 needs a backport. The _hashlib.HASH counterpart, which also affects 3.13 and 3.14, is handled in #159817.