From 8bf908a56f6674d019e641084d384bdce518fbda Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Thu, 19 Dec 2024 17:32:48 +0100 Subject: [PATCH] tests: Make sure to pass right type to buffer_pack For some reason, the mingw64 builds were failing on these inputs quite reliably as the passed value was interpretted as a value larger than UINT32_MAX. This was not caught before because the value is casted from size_t to uint32_t implicitly so the MSBs were not affecting the result. Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider --- tests/unittests/torture_buffer.c | 2 +- tests/unittests/torture_threads_buffer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unittests/torture_buffer.c b/tests/unittests/torture_buffer.c index 45022284..8f732d76 100644 --- a/tests/unittests/torture_buffer.c +++ b/tests/unittests/torture_buffer.c @@ -154,7 +154,7 @@ static void torture_ssh_buffer_add_format(void **state) { d=0xbadc0de; q=0x13243546acbdcedf; s=ssh_string_from_char("libssh"); - rc=ssh_buffer_pack(buffer, "bwdqSsPt",b,w,d,q,s,"rocks",7,"So much","Fun!"); + rc=ssh_buffer_pack(buffer, "bwdqSsPt",b,w,d,q,s,"rocks",(size_t)7,"So much","Fun!"); assert_int_equal(rc, SSH_OK); len = ssh_buffer_get_len(buffer); diff --git a/tests/unittests/torture_threads_buffer.c b/tests/unittests/torture_threads_buffer.c index de9728f2..3abc2e75 100644 --- a/tests/unittests/torture_threads_buffer.c +++ b/tests/unittests/torture_threads_buffer.c @@ -307,7 +307,7 @@ static void *thread_ssh_buffer_add_format(void *threadid) q, s, "rocks", - 7, + (size_t)7, "So much", "Fun!"); assert_int_equal(rc, SSH_OK);