From: Xavi Hernandez Date: Tue, 29 Jul 2025 08:31:45 +0000 (+0200) Subject: iconv: fixed coverity issue CID1609382 X-Git-Tag: tdb-1.4.14~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f91df3191bca58215bb3d2d76b21e49be39fab3c;p=thirdparty%2Fsamba.git iconv: fixed coverity issue CID1609382 The issue is not a real bug as it is implemented, but it's better to not mix signed and unsigned types to avoid potential future issues. Signed-off-by: Xavi Hernandez Reviewed-by: Anoop C S Reviewed-by: Gary Lockyer Autobuild-User(master): Douglas Bagnall Autobuild-Date(master): Wed Jul 30 00:44:28 UTC 2025 on atb-devel-224 --- diff --git a/lib/util/charset/tests/iconv.c b/lib/util/charset/tests/iconv.c index 2139795d0a8..3851aaf4f76 100644 --- a/lib/util/charset/tests/iconv.c +++ b/lib/util/charset/tests/iconv.c @@ -349,14 +349,18 @@ static bool test_buffer(struct torture_context *test, static bool test_codepoint(struct torture_context *tctx, unsigned int codepoint) { uint8_t buf[10]; - size_t size, size2; + ssize_t size; + size_t size2; codepoint_t c; size = push_codepoint_handle(lpcfg_iconv_handle(tctx->lp_ctx), (char *)buf, codepoint); - torture_assert(tctx, size != -1 || (codepoint >= 0xd800 && codepoint <= 0x10000), + torture_assert(tctx, + size >= 0 || + (codepoint >= 0xd800 && codepoint <= 0x10000), "Invalid Codepoint range"); - if (size == -1) return true; + if (size < 0) + return true; buf[size] = random(); buf[size+1] = random();