Crash report
Bug description:
In future_schedule_callbacks, the length of the callback list is assumed to be constant, but an evil call_soon can make it change.
PoC:
importasynciocalled_on_fut_callback0=Falsepad=lambda: ...
defevil_call_soon(*args, **kwargs):
globalcalled_on_fut_callback0ifcalled_on_fut_callback0:
# Called when handling fut->fut_callbacks[0]# and mutates the length fut->fut_callbacks.fut.remove_done_callback(int)
fut.remove_done_callback(pad)
else:
called_on_fut_callback0=Truefake_event_loop=lambda: ...
fake_event_loop.call_soon=evil_call_soonfake_event_loop.get_debug=lambda: False# suppress tracebackfut=asyncio.Future(loop=fake_event_loop)
fut.add_done_callback(str) # sets fut->fut_callback0fut.add_done_callback(int) # sets fut->fut_callbacks[0]fut.add_done_callback(pad) # sets fut->fut_callbacks[1]fut.add_done_callback(pad) # sets fut->fut_callbacks[2]fut.set_result("boom")CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Crash report
Bug description:
In
future_schedule_callbacks, the length of the callback list is assumed to be constant, but an evilcall_sooncan make it change.PoC:
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
future_schedule_callbacksdue to an evilcall_soon#125970future_schedule_callbacksdue to an evilcall_soon(GH-125970) #125991future_schedule_callbacksdue to an evilcall_soon(GH-125970) #125992