mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 04:43: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:
parent
e2662ffee6
commit
dc9e02697d
@ -334,7 +334,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();
|
||||
@ -363,6 +363,9 @@ jrd_req* JrdStatement::findRequest(thread_db* tdbb)
|
||||
break;
|
||||
}
|
||||
|
||||
if (unique)
|
||||
return NULL;
|
||||
|
||||
++count;
|
||||
}
|
||||
else if (!(next->req_flags & req_in_use) && !clone)
|
||||
|
@ -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);
|
||||
|
@ -547,13 +547,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 (auto 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);
|
||||
|
Loading…
Reference in New Issue
Block a user