The Py_BuildValue format string specification being used in pyeventlog.c, "y#" expands to a char * and a Py_ssize_t parameter. The values passed in at the corresponding va_arg positions are char* and int32_t, respectively.
On Intel Macs, int32_t is not aligned to the same 64-bit boundary as Py_ssize_t, making this an invalid cast.
The symptom is a MemoryError which occurs when trying to read_next_event()
The
Py_BuildValue
format string specification being used inpyeventlog.c
,"y#"
expands to achar *
and aPy_ssize_t
parameter. The values passed in at the corresponding va_arg positions arechar*
andint32_t
, respectively.On Intel Macs,
int32_t
is not aligned to the same 64-bit boundary asPy_ssize_t
, making this an invalid cast.The symptom is a
MemoryError
which occurs when trying toread_next_event()
The problem has been demonstrated by @ihilt with a CI pipeline based on this commit.
This PR widens the
channellen
anddatalen
before passing them intoPy_BuildValue
.