python / python/cpython

Ensure that HMAC objects are properly initialized

Abierto
#155,843 0 comentarios 0 reacciones 1 asignado Ver en GitHub

@picnixz ya está trabajando en esto.

Desde el 15/8/2026.

extension-modules type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

Bug report

Bug description:

This affects the following situations:

  • _hmac.new() frees an uninitialized HACL pointer when the key exceeds UINT32_MAX
  • _hmac_HMAC_copy_impl runs HASHLIB_INIT_MUTEX(copy) after the fallible hmac_copy_state

The solution is simply to always entirely initialize the HMAC object before working with it. We also change the usage of PyObject_New to tp->tp_alloc directly so that we only alter fields for which the 0-value would not be suitable.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs
  • gh-155845
  • gh-157036
  • gh-157037

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.