From 700f474e0902b4ff6b28aa160b1756ac896b9122 Mon Sep 17 00:00:00 2001 From: Ev3nt Date: Wed, 23 Jul 2025 11:05:22 +0300 Subject: [PATCH 1/3] Fixed crash after calling incorrectly parametrized request --- src/jrd/extds/ExtDS.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/jrd/extds/ExtDS.cpp b/src/jrd/extds/ExtDS.cpp index c952e12cfa8..43de409f455 100644 --- a/src/jrd/extds/ExtDS.cpp +++ b/src/jrd/extds/ExtDS.cpp @@ -2273,13 +2273,16 @@ void Statement::setInParams(thread_db* tdbb, const MetaName* const* names, const MetaString* sqlName = m_sqlParamsMap[sqlNum]; unsigned int num = 0; - for (; num < count; num++) + if (names) { - if (*names[num] == *sqlName) - break; + for (; num < count; num++) + { + if (*names[num] == *sqlName) + break; + } } - if (num == count) + if (!names || (num == count)) { m_error = true; // Input parameter ''@1'' have no value set From 5e1ecff566e5cb9ffa9ba8f5c70553f06b57ea34 Mon Sep 17 00:00:00 2001 From: Ev3nt Date: Thu, 24 Jul 2025 08:34:48 +0300 Subject: [PATCH 2/3] Patch: Fixed crash after calling incorrectly parametrized request --- src/jrd/extds/ExtDS.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/jrd/extds/ExtDS.cpp b/src/jrd/extds/ExtDS.cpp index 43de409f455..c6aca7724a0 100644 --- a/src/jrd/extds/ExtDS.cpp +++ b/src/jrd/extds/ExtDS.cpp @@ -2237,6 +2237,12 @@ void Statement::setInParams(thread_db* tdbb, const MetaName* const* names, const FB_SIZE_T excCount = in_excess ? in_excess->getCount() : 0; const FB_SIZE_T sqlCount = m_sqlParamNames.getCount(); + if (m_error = (!names && sqlCount)) + { + // Parameter name expected + ERR_post(Arg::Gds(isc_eds_prm_name_expected)); + } + // OK : count - excCount <= sqlCount <= count // Check if all passed named parameters, not marked as excess, are present in query text @@ -2273,16 +2279,13 @@ void Statement::setInParams(thread_db* tdbb, const MetaName* const* names, const MetaString* sqlName = m_sqlParamsMap[sqlNum]; unsigned int num = 0; - if (names) + for (; num < count; num++) { - for (; num < count; num++) - { - if (*names[num] == *sqlName) - break; - } + if (*names[num] == *sqlName) + break; } - if (!names || (num == count)) + if (num == count) { m_error = true; // Input parameter ''@1'' have no value set From 24c74e14e80be8c8e58b8931443b31e908da2673 Mon Sep 17 00:00:00 2001 From: "bogdan.khavronin" Date: Mon, 22 Sep 2025 15:11:26 +0300 Subject: [PATCH 3/3] ALICE_print fix, isError flag added --- src/alice/alice.cpp | 12 +++++++++--- src/alice/alice_proto.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/alice/alice.cpp b/src/alice/alice.cpp index 2262f23e2cb..0ea4983b8f8 100644 --- a/src/alice/alice.cpp +++ b/src/alice/alice.cpp @@ -557,7 +557,7 @@ int alice(Firebird::UtilSvc* uSvc) if (any_error) { - ALICE_print(24); // msg 24: Summary of validation errors\n + ALICE_print(24, SafeArg(), false); // msg 24: Summary of validation errors\n for (int i = 0; i < MAX_VAL_ERRORS; ++i) { @@ -637,13 +637,19 @@ void ALICE_upper_case(const TEXT* in, TEXT* out, const size_t buf_size) // Display a formatted error message // -void ALICE_print(USHORT number, const SafeArg& arg) +void ALICE_print(USHORT number, const SafeArg& arg, const bool isError) { AliceGlobals* tdgbl = AliceGlobals::getSpecific(); if (tdgbl->uSvc->isService()) { + if (!isError) + tdgbl->uSvc->started(); + tdgbl->uSvc->getStatusAccessor().setServiceStatus(ALICE_MSG_FAC, number, arg); - tdgbl->uSvc->started(); + + if (isError) + tdgbl->uSvc->started(); + return; } diff --git a/src/alice/alice_proto.h b/src/alice/alice_proto.h index 7e32c080510..3f7fdc377ce 100644 --- a/src/alice/alice_proto.h +++ b/src/alice/alice_proto.h @@ -34,7 +34,7 @@ int alice(Firebird::UtilSvc*); class AliceGlobals; void ALICE_upper_case(const TEXT*, TEXT*, const size_t); -void ALICE_print(USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg()); +void ALICE_print(USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg(), const bool isError = true); void ALICE_error(USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg()); void ALICE_print_status(bool error, const ISC_STATUS*); void ALICE_exit(int, AliceGlobals*);