Fix re-entrancy in IncomingStream::ReadFromPipeAndEnqueue()
The method blink::IncomingStream::ReadFromPipeAndEnqueue() can be called re-entrantly when 1. A read() is pending 2. OnHandleReady() calls ReadFromPipeAndEnqueue() 3. Enqueue() results in a call to pull() (to re-fill the queue) 4. pull() calls ReadFromPipeAndEnqueue() Since there cannot be two calls to BeginReadData() in progress, this causes a fatal error. Add a flag |in_two_phase_read_| which causes ReadFromPipeAndEnqueue() to return early. Add another flag |read_pending_| which indicates that ReadFromPipeAndEnqueue() has returned early and that it should be called again when the current read completes. Also add a unit test for this condition. BUG=1064434 Change-Id: I7b367e466a0c5c2e1abccc0a688d2098e17143f9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2124331 Commit-Queue: Adam Rice <ricea@chromium.org> Reviewed-by:Yutaka Hirano <yhirano@chromium.org> Cr-Commit-Position: refs/heads/master@{#754436}
Showing
Please register or sign in to comment