Skip to content

Commit 156bb05

Browse files
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.
1 parent 6357bc2 commit 156bb05

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

msgpack/unpack_container_header.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ static inline int unpack_container_header(unpack_context* ctx, const char* data,
4545
PyErr_SetString(PyExc_ValueError, "Unexpected type header on stream");
4646
return -1;
4747
}
48-
unpack_callback_uint32(&ctx->user, size, &ctx->stack[0].obj);
48+
49+
if (unpack_callback_uint32(&ctx->user, size, &ctx->stack[0].obj) < 0)
50+
return -1;
51+
4952
return 1;
5053
}
5154

0 commit comments

Comments
 (0)