From bf4e792523b9da678b0c91ca610a08874d498550 Mon Sep 17 00:00:00 2001 From: Filimonova Anna Date: Wed, 3 Sep 2025 21:23:52 +0300 Subject: [PATCH 1/3] Fix snprintf return value --- src/common/StatusArg.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/common/StatusArg.cpp b/src/common/StatusArg.cpp index a4fb738e530..c5f1774e613 100644 --- a/src/common/StatusArg.cpp +++ b/src/common/StatusArg.cpp @@ -407,19 +407,22 @@ Num::Num(ISC_STATUS s) noexcept : Int64::Int64(SINT64 val) noexcept : Str(text) { - snprintf(text, sizeof(text), "%" SQUADFORMAT, val); + (void)snprintf(text, sizeof(text), "%" SQUADFORMAT, val); } Int64::Int64(FB_UINT64 val) noexcept : Str(text) { - snprintf(text, sizeof(text), "%" UQUADFORMAT, val); + (void)snprintf(text, sizeof(text), "%" UQUADFORMAT, val); } Quad::Quad(const ISC_QUAD* quad) noexcept : Str(text) { - snprintf(text, sizeof(text), "%x:%x", quad->gds_quad_high, quad->gds_quad_low); + (void)snprintf(text, sizeof(text), "%x:%x", + (unsigned int)quad->gds_quad_high, + (unsigned int)quad->gds_quad_low + ); } Interpreted::Interpreted(const char* text) noexcept : From 7b65a8e09a1680b8081dae3283b9279b3b245e6d Mon Sep 17 00:00:00 2001 From: Filimonova Anna Date: Thu, 2 Oct 2025 20:07:48 +0300 Subject: [PATCH 2/3] fix_snprintf_retval: use static_cast --- src/common/StatusArg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/StatusArg.cpp b/src/common/StatusArg.cpp index c5f1774e613..39abf70643b 100644 --- a/src/common/StatusArg.cpp +++ b/src/common/StatusArg.cpp @@ -420,8 +420,8 @@ Quad::Quad(const ISC_QUAD* quad) noexcept : Str(text) { (void)snprintf(text, sizeof(text), "%x:%x", - (unsigned int)quad->gds_quad_high, - (unsigned int)quad->gds_quad_low + static_cast(quad->gds_quad_high), + quad->gds_quad_low ); } From 9a73c13d581947f1621d4525e614d71c44dfb688 Mon Sep 17 00:00:00 2001 From: Filimonova Anna Date: Sat, 11 Oct 2025 16:32:27 +0300 Subject: [PATCH 3/3] assert snprintf return value in StatusArg.cpp --- src/common/StatusArg.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/common/StatusArg.cpp b/src/common/StatusArg.cpp index 39abf70643b..cf6554434b9 100644 --- a/src/common/StatusArg.cpp +++ b/src/common/StatusArg.cpp @@ -407,22 +407,25 @@ Num::Num(ISC_STATUS s) noexcept : Int64::Int64(SINT64 val) noexcept : Str(text) { - (void)snprintf(text, sizeof(text), "%" SQUADFORMAT, val); + [[maybe_unused]] auto result = snprintf(text, sizeof(text), "%" SQUADFORMAT, val); + fb_assert(result >= 0); } Int64::Int64(FB_UINT64 val) noexcept : Str(text) { - (void)snprintf(text, sizeof(text), "%" UQUADFORMAT, val); + [[maybe_unused]] auto result = snprintf(text, sizeof(text), "%" UQUADFORMAT, val); + fb_assert(result >= 0); } Quad::Quad(const ISC_QUAD* quad) noexcept : Str(text) { - (void)snprintf(text, sizeof(text), "%x:%x", + [[maybe_unused]] auto result = snprintf(text, sizeof(text), "%x:%x", static_cast(quad->gds_quad_high), quad->gds_quad_low ); + fb_assert(result >= 0); } Interpreted::Interpreted(const char* text) noexcept :