Skip to content

Improve error-branches of hashlib #127667

@picnixz

Description

@picnixz

Bug report

Bug description:

While reading the hashlib code, I found some issues in the error branches where the EVP_MD_ctx is not freed upon failure or when we call py_digest_name with a NULL EVP_MD *.

@gpshead Should I consider this as a security issue? (some places might be a security issue since we are leaking some EVP_MD context objects but others are just leaking un-initialized contexts).

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions