Skip to content

gh-146388: Add null check for sym_new(ctx) in make_bottom#146389

Merged
Fidget-Spinner merged 7 commits intopython:mainfrom
A0su:Fix_null_deref_in_make_bottom
Mar 27, 2026
Merged

gh-146388: Add null check for sym_new(ctx) in make_bottom#146389
Fidget-Spinner merged 7 commits intopython:mainfrom
A0su:Fix_null_deref_in_make_bottom

Conversation

@A0su
Copy link
Contributor

@A0su A0su commented Mar 24, 2026

optimizer_symbols.c: make_bottom NULL deref when arena full

sym_new(ctx) at line 1535 can return NULL when the type arena is full. Result immediately dereferenced without check. Every other sym_new call site checks for NULL.

This is a sub-issue of #146102 with gist details

@bedevere-app
Copy link

bedevere-app bot commented Mar 24, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app
Copy link

bedevere-app bot commented Mar 24, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@A0su A0su marked this pull request as draft March 24, 2026 19:42
@bedevere-app
Copy link

bedevere-app bot commented Mar 24, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@A0su A0su marked this pull request as ready for review March 25, 2026 01:58
@aisk
Copy link
Member

aisk commented Mar 26, 2026

I think this fix is simple enough which doesn't requires a test, but the news entry is required. Can you add it follow the Dev Guide? https://devguide.python.org/getting-started/pull-request-lifecycle/#updating-news-and-what-s-new-in-python

@A0su
Copy link
Contributor Author

A0su commented Mar 26, 2026

@aisk, blurb added. Thanks for the review!

@@ -0,0 +1 @@
Add a null check for :func:`sym_new(ctx)` in :func:`make_bottom`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't tell much. Can it be more descriptive please? Something like

Handle when JIT optimizer runs out of space when dealing with contradictions.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'm not sure that the NEWS entry is worth it, it's a corner case which is unlikely to occur in practice, no?

@Fidget-Spinner Fidget-Spinner merged commit c8ee196 into python:main Mar 27, 2026
114 of 116 checks passed
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.

5 participants