8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:03:03 +01:00

Additional patch for CORE-6015 : Segfault when using expression index with complex expression.

Changed way to detect indirect recursion: when req_caller chain is broken by EXECUTE STATEMENT.
This commit is contained in:
hvlad 2021-04-20 23:11:10 +03:00
parent a34b48586d
commit 5bbf69b5b3
3 changed files with 9 additions and 8 deletions

View File

@ -317,7 +317,7 @@ bool JrdStatement::isActive() const
return false;
}
jrd_req* JrdStatement::findRequest(thread_db* tdbb)
jrd_req* JrdStatement::findRequest(thread_db* tdbb, bool unique)
{
SET_TDBB(tdbb);
Attachment* const attachment = tdbb->getAttachment();
@ -346,6 +346,9 @@ jrd_req* JrdStatement::findRequest(thread_db* tdbb)
break;
}
if (unique)
return NULL;
++count;
}
else if (!(next->req_flags & req_in_use) && !clone)

View File

@ -51,7 +51,7 @@ public:
const Routine* getRoutine() const;
bool isActive() const;
jrd_req* findRequest(thread_db* tdbb);
jrd_req* findRequest(thread_db* tdbb, bool unique = false);
jrd_req* getRequest(thread_db* tdbb, USHORT level);
void verifyAccess(thread_db* tdbb);
void release(thread_db* tdbb);

View File

@ -526,13 +526,11 @@ DSC* BTR_eval_expression(thread_db* tdbb, index_desc* idx, Record* record, bool&
// check for resursive expression evaluation
jrd_req* const org_request = tdbb->getRequest();
for (jrd_req* req = org_request; req; req = req->req_caller)
{
if (req->getStatement() == idx->idx_expression_statement)
ERR_post(Arg::Gds(isc_random) << "Attempt to evaluate index expression recursively");
}
jrd_req* const expr_request = idx->idx_expression_statement->findRequest(tdbb, true);
if (expr_request == NULL)
ERR_post(Arg::Gds(isc_random) << "Attempt to evaluate index expression recursively");
jrd_req* const expr_request = idx->idx_expression_statement->findRequest(tdbb);
fb_assert(expr_request != org_request);
fb_assert(expr_request->req_caller == NULL);