fix: check return code in unpack_callback_int64 (#665)

This commit is contained in:
Thomas Kowalski 2026-04-21 11:27:11 +02:00 committed by GitHub
parent 5d465bdb77
commit 95c8be516d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -70,12 +70,7 @@ static inline int unpack_callback_uint32(unpack_user* u, uint32_t d, msgpack_unp
static inline int unpack_callback_uint64(unpack_user* u, uint64_t d, msgpack_unpack_object* o)
{
PyObject *p;
if (d > LONG_MAX) {
p = PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)d);
} else {
p = PyLong_FromLong((long)d);
}
PyObject *p = PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)d);
if (!p)
return -1;
*o = p;
@ -103,12 +98,9 @@ static inline int unpack_callback_int8(unpack_user* u, int8_t d, msgpack_unpack_
static inline int unpack_callback_int64(unpack_user* u, int64_t d, msgpack_unpack_object* o)
{
PyObject *p;
if (d > LONG_MAX || d < LONG_MIN) {
p = PyLong_FromLongLong((PY_LONG_LONG)d);
} else {
p = PyLong_FromLong((long)d);
}
PyObject *p = PyLong_FromLongLong((PY_LONG_LONG)d);
if (!p)
return -1;
*o = p;
return 0;
}