Skip to content

Lock font image object in getmask() - #10754

Open
lazerg wants to merge 1 commit into
python-pillow:mainfrom
lazerg:fix/issue-10753-font-getmask-lock
Open

lazerg wants to merge 1 commit into
python-pillow:mainfrom
lazerg:fix/issue-10753-font-getmask-lock

Conversation

@lazerg

@lazerg lazerg commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Origin: A) Fixes existing issue #10753

_font_getmask() passed self->bitmap to the critical section, but that is the raw Imaging struct, not a Python object, so the font's image was never locked and the macro wrote its lock byte into the struct. This locks self->ref instead, the ImagingObject that owns the bitmap. With the reproducer from the issue on a free-threaded ASan build, the use-after-free against putpalette() is gone.

This branch has not been deployed

No deployments
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.

1 participant