Skip to content

Commit cb75f5c

Browse files
FrancescoCerutiperexg
authored andcommitted
alsaseq: fix seg. fault when accessing ConstantObject extra
Closes: #10 Signed-off-by: Francesco Ceruti <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]>
1 parent 7d6dfe0 commit cb75f5c

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

pyalsa/alsaseq.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -353,18 +353,11 @@ typedef struct {
353353
} ConstantObject;
354354

355355
#if PY_MAJOR_VERSION < 3
356-
/* PyInt is fixed size in Python 2 */
357356
# define CONST_VALUE(x) PyInt_AsLong((PyObject *)x)
358-
# define CONST_EXTRA(x) (&(x->extra))
359357
#else
360-
/* PyLong is variable size in Python 3 */
361358
# define CONST_VALUE(x) PyLong_AsLong((PyObject *)x)
362-
# define CONST_EXTRA(x) \
363-
((ConstantExtraFields *)( \
364-
((intptr_t)(&x->extra)) \
365-
+ abs(Py_SIZE(&x->base)) * Py_TYPE(x)->tp_itemsize \
366-
))
367359
#endif
360+
# define CONST_EXTRA(x) (&(x->extra))
368361

369362
/** alsaseq.Constant type (initialized later...) */
370363
static PyTypeObject ConstantType;

0 commit comments

Comments
 (0)