mirror of
https://github.com/python/cpython.git
synced 2026-06-17 15:16:42 +00:00
[3.13] gh-145376: Fix crashes in md5module.c (GH-145422) (#145611)
* gh-145376: Fix crashes in md5module.c
Fix a possible NULL pointer dereference in `md5module.c`.
This can only occur in error paths taken when the interpreter fails to allocate memory.
(cherry-picked from c1d7768321)
* 📜🤖 Added by blurb_it.
* Update Modules/md5module.c
---------
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
This commit is contained in:
parent
16dbbe56f0
commit
ae7206eb3b
2 changed files with 5 additions and 1 deletions
|
|
@ -0,0 +1 @@
|
|||
Fix null pointer dereference in unusual error scenario in :mod:`hashlib`.
|
||||
|
|
@ -84,7 +84,10 @@ MD5_traverse(PyObject *ptr, visitproc visit, void *arg)
|
|||
static void
|
||||
MD5_dealloc(MD5object *ptr)
|
||||
{
|
||||
Hacl_Hash_MD5_free(ptr->hash_state);
|
||||
if (ptr->hash_state != NULL) {
|
||||
Hacl_Hash_MD5_free(ptr->hash_state);
|
||||
ptr->hash_state = NULL;
|
||||
}
|
||||
PyTypeObject *tp = Py_TYPE((PyObject*)ptr);
|
||||
PyObject_GC_UnTrack(ptr);
|
||||
PyObject_GC_Del(ptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue