Skip to content

Instantly share code, notes, and snippets.

@devdanzin
Created March 18, 2026 10:07
Show Gist options
  • Select an option

  • Save devdanzin/4fe9c3299dd2269bd849bba147ade0b4 to your computer and use it in GitHub Desktop.

Select an option

Save devdanzin/4fe9c3299dd2269bd849bba147ade0b4 to your computer and use it in GitHub Desktop.
structseq.c: NULL dereference in get_type_attr_as_size

structseq.c: NULL dereference in get_type_attr_as_size

Summary

When PyDict_GetItemWithError returns NULL due to error (not missing key), code falls through to PyLong_AsSsize_t(NULL) at line 37 → segfault. Affects PyStructSequence_New, structseq_new_impl, etc.

Fix

Add early return when v == NULL && PyErr_Occurred().

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