Skip to content

ExtensionFileLoader.load_module aborts when initialized with a path containing null-bytes #127208

@devdanzin

Description

@devdanzin

Crash report

What happened?

It's possible to abort a debug build by initializing a _frozen_importlib_external.ExtensionFileLoader with a path containing null-bytes, then calling load_module():

import _frozen_importlib_external

_frozen_importlib_external.ExtensionFileLoader("a", "\x00").load_module(None)

Abort message:

python: Python/import.c:939: hashtable_key_from_2_strings: Assertion `strlen(key) == size - 1' failed.
Aborted

Found using fusil by @vstinner.

CPython versions tested on:

3.12, 3.13, 3.14, CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.14.0a2+ (heads/main:0af4ec3, Nov 20 2024, 21:45:19) [GCC 13.2.0]

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)topic-importlibtype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions