Skip to content

Conversation

@radarhere
Copy link
Member

@radarhere radarhere commented Dec 30, 2025

Resolves #9361

Within font_getvarnames(), our code goes through the names, and once the ID of a name matches the ID of a style, it breaks. It presumes that each master->namedstyle would have a unique ID.

Pillow/src/_imagingft.c

Lines 1280 to 1291 in 2ebb3e9

if (master->namedstyle[j].strid == name.name_id) {
list_name = Py_BuildValue("y#", name.string, name.string_len);
if (list_name == NULL) {
PyMem_Free(list_names_filled);
Py_DECREF(list_names);
FT_Done_MM_Var(library, master);
return NULL;
}
PyList_SetItem(list_names, j, list_name);
list_names_filled[j] = 1;
break;
}

The font found in the issue has two styles with the same ID. To allow for this, we should no longer break and continue to go through the loop. Once the list has been populated in C, Python can remove the duplicate result.

I created a test font here from our existing AdobeVFPrototype.ttf using ttx.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@hugovk hugovk mentioned this pull request Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segfaults when using the 39C3 font from Chaos Communication congress

2 participants