Handle invalid Continuation state at start time
In an unlikely situation a user of ext_asio may tamper with Continuation before passing it to the ext_asio extension. Let's fail with an exception if this happens. Previously, a user bug would stay unnoticed, but would not harm the ext_asio code. This check will be needed once we implement optimistic execution. With optimistic execution, we iterate continuation and defer construction of ContinuationWaitHandle until the first blocking event occurs. During this phase, a standard dependency loop detection is skipped and the code would try to iterate a continuation that is already being iterated.
Esse commit está contido em:
@@ -71,6 +71,14 @@ Object c_ContinuationWaitHandle::ti_start(const char* cls, CObjRef continuation)
|
||||
return cont->m_waitHandle;
|
||||
}
|
||||
|
||||
if (UNLIKELY(cont->m_index != -1)) {
|
||||
Object e(SystemLib::AllocInvalidOperationExceptionObject(
|
||||
cont->m_running
|
||||
? "Encountered an attempt to start currently running continuation"
|
||||
: "Encountered an attempt to start tainted continuation"));
|
||||
throw e;
|
||||
}
|
||||
|
||||
p_ContinuationWaitHandle wh = NEWOBJ(c_ContinuationWaitHandle)();
|
||||
wh->start(cont, depth + 1);
|
||||
if (UNLIKELY(session->hasOnStartedCallback())) {
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário