Skip to content

gh-159739: Detect recursive untyped ctypes arguments - #160194

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-ctypes-untyped-recursion
Oct 22, 2026
Merged

JelleZijlstra merged 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-ctypes-untyped-recursion

Conversation

@jelle-openai

@jelle-openai jelle-openai commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

as_parameter chains were recursion-checked for typed arguments but not for foreign calls without argtypes. A cyclic chain could exhaust the C stack and crash before the function was called. Apply the same recursion guard to untyped conversion. Backport to 3.15 and 3.14.

_as_parameter_ chains were recursion-checked for typed arguments but not for foreign calls without argtypes. A cyclic chain could exhaust the C stack and crash before the function was called. Apply the same recursion guard to untyped conversion. Backport to 3.15 and 3.14.
@JelleZijlstra
JelleZijlstra merged commit 3e19e04 into python:main Oct 22, 2026
58 checks passed
@JelleZijlstra JelleZijlstra added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 22, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @jelle-openai for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @jelle-openai for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @jelle-openai for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 22, 2026
…160194)

_as_parameter_ chains were recursion-checked for typed arguments but not for foreign calls without argtypes. A cyclic chain could exhaust the C stack and crash before the function was called. Apply the same recursion guard to untyped conversion. Backport to 3.15 and 3.14.
(cherry picked from commit 3e19e04)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
@bedevere-app

bedevere-app Bot commented Oct 22, 2026

Copy link
Copy Markdown

GH-160350 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 22, 2026
@bedevere-app

bedevere-app Bot commented Oct 22, 2026

Copy link
Copy Markdown

GH-160351 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Oct 22, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry @jelle-openai and @JelleZijlstra, I had trouble completing the backport.

Please retry by removing and re-adding the "needs backport to 3.14" label.
If that does not work, please backport manually with cherry_picker, see the devguide for more information.

cherry_picker 3e19e0408d9791c235c6c85818de1b9b2eb93dfa 3.14

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 22, 2026
…160194)

_as_parameter_ chains were recursion-checked for typed arguments but not for foreign calls without argtypes. A cyclic chain could exhaust the C stack and crash before the function was called. Apply the same recursion guard to untyped conversion. Backport to 3.15 and 3.14.
(cherry picked from commit 3e19e04)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
@miss-islington-app

Copy link
Copy Markdown

Sorry @jelle-openai and @JelleZijlstra, I had trouble completing the backport.

Please retry by removing and re-adding the "needs backport to 3.15" label.
If that does not work, please backport manually with cherry_picker, see the devguide for more information.

cherry_picker 3e19e0408d9791c235c6c85818de1b9b2eb93dfa 3.15

JelleZijlstra pushed a commit that referenced this pull request Oct 22, 2026
… (#160351)

_as_parameter_ chains were recursion-checked for typed arguments but not for foreign calls without argtypes. A cyclic chain could exhaust the C stack and crash before the function was called. Apply the same recursion guard to untyped conversion. Backport to 3.15 and 3.14.
(cherry picked from commit 3e19e04)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants