diff --git a/src/box/xrow.c b/src/box/xrow.c index e8d5dd4462ae2f890f0a3b295fb70163680669f3..10b4dd370fb659887ffad18890199ce6b1ac4d8c 100644 --- a/src/box/xrow.c +++ b/src/box/xrow.c @@ -1301,7 +1301,8 @@ xrow_decode_synchro(const struct xrow_header *row, struct synchro_request *req) continue; } uint8_t key = mp_decode_uint(&d); - if (key < iproto_key_MAX && iproto_key_type[key] != type) { + if (key < iproto_key_MAX && + iproto_key_type[key] != mp_typeof(*d)) { xrow_on_decode_err(row, ER_INVALID_MSGPACK, "request body"); return -1; diff --git a/test/unit/xrow.cc b/test/unit/xrow.cc index d08fa8b150f429361c360d4fe5fd09c8f710ff3e..d07fdf1b38201f4b84924c31e49cbf13dbaa8df6 100644 --- a/test/unit/xrow.cc +++ b/test/unit/xrow.cc @@ -540,6 +540,31 @@ test_xrow_decode_unknown_key(void) footer(); } +static void +test_xrow_decode_synchro_types(void) +{ + header(); + plan(1); + + char buf[128]; + + const char *p = buf; + const char *end = buf + mp_format(buf, sizeof(buf), "{%u%s}", + IPROTO_INSTANCE_UUID, "someuuid"); + struct xrow_header header; + memset(&header, 0, sizeof(header)); + header.bodycnt = 1; + header.body[0].iov_base = buf; + header.body[0].iov_len = mp_format(buf, sizeof(buf), "{%u%s}", + IPROTO_INSTANCE_UUID, "someuuid"); + struct synchro_request synchro; + is(xrow_decode_synchro(&header, &synchro), 0, + "xrow_decode_synchro correctly handles key types"); + + check_plan(); + footer(); +} + static void test_xrow_decode_error_1(void) { @@ -769,7 +794,7 @@ main(void) memory_init(); fiber_init(fiber_c_invoke); header(); - plan(12); + plan(13); random_init(); @@ -786,6 +811,7 @@ main(void) test_xrow_decode_error_4(); test_xrow_decode_error_gh_9098(); test_xrow_decode_error_gh_9136(); + test_xrow_decode_synchro_types(); random_free(); fiber_free();