Skip to content

Improve error-branches of hashlib #127667

Closed
Closed

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

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    3.12only security fixes
    3.13only security fixes
    3.14bugs and security fixes
    on Dec 6, 2024
  2. self-assigned this
    on Dec 6, 2024
  3. changed the title [-]Memory leaks in error-branches of `hashlib`[/-] [+]Improve error-branches of `hashlib`[/+] on Jan 5, 2025
  4. added 5 commits that reference this issue on Mar 3, 2025
  5. added 3 commits that reference this issue on Mar 17, 2025
  6. added a commit that references this issue on Mar 17, 2025
  7. added 2 commits that reference this issue on Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13only 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