Fix a SimpleUrlLoader stream resume-after-timeout crash
Add a null check in DownloadAsStreamBodyHandler::Resume to protect against a rare case where Resume is called right after hitting the timeout. To demonstrate the crash, add a unit test that explicitly keeps hold of the resume closure until after a timeout is hit. Without the added fix, the test crashes accessing body_reader_. While it looks odd in the test, this case seems possible in valid-looking SimpleURLLoaderStreamConsumer code that happens to get tasks queued in an unlucky way right when the timeout is hit. Credit to mruszczynski@vewd.com for investigation and initial UT. Bug: 1169018 Change-Id: Iff38fb1e3a4404ae006e1f6b76479cdf6ffafa85 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2641033 Commit-Queue: Tomasz Śniatowski <tsniatowski@vewd.com> Commit-Queue: Yutaka Hirano <yhirano@chromium.org> Auto-Submit: Tomasz Śniatowski <tsniatowski@vewd.com> Reviewed-by:Yutaka Hirano <yhirano@chromium.org> Cr-Commit-Position: refs/heads/master@{#846019}
Showing
Please register or sign in to comment