Skip to content

Instantly share code, notes, and snippets.

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

  • Save devdanzin/55ed5cf0d452eb6ce881e7a8fad30ddb to your computer and use it in GitHub Desktop.

Select an option

Save devdanzin/55ed5cf0d452eb6ce881e7a8fad30ddb to your computer and use it in GitHub Desktop.
ceval.c: Missing PyErr_NoMemory in _PyObjectArray_FromStackRefArray + PyEval_GetLocals NULL deref

ceval.c: Missing PyErr_NoMemory in _PyObjectArray_FromStackRefArray + PyEval_GetLocals NULL deref

Summary

  1. _PyObjectArray_FromStackRefArray (line 1112): PyMem_Malloc returns NULL without exception. Affects ~10 vectorcall functions → SystemError.
  2. PyEval_GetLocals (line 2622): _PyFrame_GetFrameObject can return NULL, immediately dereferenced → segfault.

Fix

  1. Add PyErr_NoMemory() after PyMem_Malloc failure.
  2. Add NULL check after _PyFrame_GetFrameObject.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment