X Tutup
The Wayback Machine - https://web.archive.org/web/20250920081209/https://github.com/python/cpython/pull/139147
Skip to content

Conversation

zeff-ir
Copy link
Contributor

@zeff-ir zeff-ir commented Sep 19, 2025

In test_pre_initialization_sys_options() (Programs/_testembed.c),
the results of calloc() were not checked before passing the pointers
to wcsncpy(). On allocation failure (OOM), this could lead to a NULL dereference.

This patch adds NULL checks for both allocations and frees already allocated
memory before returning on error.

Fixes gh-139146

skip news

…s_options

Reported by: Dmitrii Chuprov cheese@altlinux.org
Signed-off-by: Denis Sergeev zeff@altlinux.org
@zeff-ir zeff-ir force-pushed the fix-deref-of-null-testembed branch from b4619e8 to 3be06fb Compare September 19, 2025 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible NULL dereference on calloc() failure in test_pre_initialization_sys_options() (Programs/_testembed.c)
2 participants
X Tutup