From 08dc25f8c45342a73c786bc60571c8a5f2c8c6e3 Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Sat, 27 Jul 2024 14:48:41 +0300 Subject: [PATCH] Simplest fix for #8185: SIGSEGV in Firebird 5.0.0.1306 embedded during update on cursor - disallow caching for positioned updates/deletes --- src/dsql/DsqlRequests.cpp | 2 ++ src/dsql/dsql.cpp | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dsql/DsqlRequests.cpp b/src/dsql/DsqlRequests.cpp index b9d0b2f4cac..21f5c87ce93 100644 --- a/src/dsql/DsqlRequests.cpp +++ b/src/dsql/DsqlRequests.cpp @@ -177,6 +177,8 @@ void DsqlRequest::destroy(thread_db* tdbb, DsqlRequest* dsqlRequest) { childStatement->addFlags(DsqlStatement::FLAG_ORPHAN); childStatement->setParentRequest(nullptr); + childStatement->setParentDbKey(nullptr); + childStatement->setParentRecVersion(nullptr); // hvlad: lines below is commented out as // - child is already unlinked from its parent request diff --git a/src/dsql/dsql.cpp b/src/dsql/dsql.cpp index 35476271490..8894a6c4c45 100644 --- a/src/dsql/dsql.cpp +++ b/src/dsql/dsql.cpp @@ -620,7 +620,11 @@ static RefPtr prepareStatement(thread_db* tdbb, dsql_dbb* databas if (!isInternalRequest && dsqlStatement->mustBeReplicated()) dsqlStatement->setOrgText(text, textLength); - if (isStatementCacheActive && dsqlStatement->isDml()) + const bool basedOnCursor = + (dsqlStatement->getType() & (DsqlStatement::TYPE_UPDATE_CURSOR | + DsqlStatement::TYPE_DELETE_CURSOR)); + + if (isStatementCacheActive && dsqlStatement->isDml() && !basedOnCursor) { database->dbb_statement_cache->putStatement(tdbb, textStr, clientDialect, isInternalRequest, dsqlStatement);