fix: check unpack_callback_uint32 result (#666)

Similar to #665, just a return value check to propagate the error in
case one happens (instead of silently ignoring it).

Note that as opposed to the previous lines, we don't need to
`PyErr_SetString` since `unpack_callback_uint32` calls
`PyLong_FromSize_t` which itself should set whatever Python error is
relevant; we just need to make it clear to the caller that an error
occurred.
This commit is contained in:
Thomas Kowalski 2026-04-21 09:22:06 +02:00 committed by GitHub
parent 6357bc272c
commit 156bb05a15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,7 +45,10 @@ static inline int unpack_container_header(unpack_context* ctx, const char* data,
PyErr_SetString(PyExc_ValueError, "Unexpected type header on stream");
return -1;
}
unpack_callback_uint32(&ctx->user, size, &ctx->stack[0].obj);
if (unpack_callback_uint32(&ctx->user, size, &ctx->stack[0].obj) < 0)
return -1;
return 1;
}