Skip to content

Instantly share code, notes, and snippets.

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

  • Save devdanzin/266ca45099796a2373866a07447d5ebf to your computer and use it in GitHub Desktop.

Select an option

Save devdanzin/266ca45099796a2373866a07447d5ebf to your computer and use it in GitHub Desktop.
genericaliasobject.c: Two NULL dereference bugs

genericaliasobject.c: Two NULL dereference bugs

Summary

  1. ga_vectorcall (line 653): PyVectorcall_Function(alias->origin) can return NULL, immediately called as function pointer → segfault.
  2. _Py_make_parameters (line 243-245): After _PyTuple_Resize fails, parameters is NULL but Py_DECREF(parameters) is called → crash.

Fix

  1. Add NULL check and fallback to PyObject_Vectorcall.
  2. Change Py_DECREF(parameters) to Py_XDECREF(parameters) at line 245.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment