Skip to content

gh-161471: Fix crash when subscripting a ctypes pointer without _type_ - #161421

Open
PavlNekrasov wants to merge 1 commit into
python:mainfrom
PavlNekrasov:fix-ctypes-pointer-null-proto
Open

PavlNekrasov wants to merge 1 commit into
python:mainfrom
PavlNekrasov:fix-ctypes-pointer-null-proto

Conversation

@PavlNekrasov

@PavlNekrasov PavlNekrasov commented Nov 5, 2026 •

Copy link
Copy Markdown

Check proto and the PyStgInfo_FromType() result instead of relying on
assert() in Pointer_item_impl(), Pointer_ass_item_impl() and
Pointer_subscript().
@python-cla-bot

python-cla-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app

bedevere-app Bot commented Nov 5, 2026

Copy link
Copy Markdown

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.

@picnixz

picnixz commented Nov 5, 2026

Copy link
Copy Markdown
Member

Pleae create an issue.

@picnixz

picnixz commented Nov 5, 2026

Copy link
Copy Markdown
Member

The question is also: why are you subclassing ctypes._Pointer?

@sobolevn sobolevn changed the title Fix crash when subscripting a ctypes pointer without _type_ gh-161471: Fix crash when subscripting a ctypes pointer without _type_ Nov 6, 2026
@PavlNekrasov

Copy link
Copy Markdown
Author

The question is also: why are you subclassing ctypes._Pointer?

solely to reproduce the static-analysis finding

@picnixz

picnixz commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

My question was: why do you believe the finding is correct? is this a documented behavior? are there other possibilities for messing with ctypes liks that? I want to know if @ZeroIntensity considers this an issue in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ctypes: SIGSEGV when subscripting a pointer type without _type_

2 participants