mirror of
https://github.com/open62541/open62541.git
synced 2026-10-17 04:42:09 +08:00
fix(core): Clear staged async queue links
TAILQ_REMOVE leaves intrusive link fields unchanged in release builds. Clear both links before invoking cancellation callbacks so stack-local staging queue addresses cannot escape through retained operations.
This commit is contained in:
committed by
Julius Pfrommer
parent
f9eb7a4a2a
commit
437995bc22
@@ -424,6 +424,10 @@ UA_AsyncManager_cancelSession(UA_Server *server, const UA_NodeId *sessionId,
|
||||
|
||||
while((op = TAILQ_FIRST(&canceledOps))) {
|
||||
TAILQ_REMOVE(&canceledOps, op, pointers);
|
||||
/* TAILQ_REMOVE does not clear the links in release builds. Avoid
|
||||
* retaining the stack-local queue head across the callback. */
|
||||
op->pointers.tqe_next = NULL;
|
||||
op->pointers.tqe_prev = NULL;
|
||||
UA_AsyncOperation_cancel(server, op, status);
|
||||
}
|
||||
|
||||
@@ -575,6 +579,10 @@ cancelAsyncResponseOperations(UA_Server *server, UA_AsyncResponse *ar,
|
||||
* cancellation callback may reenter and mutate the waiting queue. */
|
||||
while((op = TAILQ_FIRST(&canceledOps))) {
|
||||
TAILQ_REMOVE(&canceledOps, op, pointers);
|
||||
/* TAILQ_REMOVE does not clear the links in release builds. Avoid
|
||||
* retaining the stack-local queue head across the callback. */
|
||||
op->pointers.tqe_next = NULL;
|
||||
op->pointers.tqe_prev = NULL;
|
||||
UA_AsyncOperation_cancel(server, op, status);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user