Commit f33b0b89 authored by Armando Miraglia's avatar Armando Miraglia Committed by Commit Bot

[Video Capture Manager] Delete all occurrences of device start requests queued.

The vulnerability indicated in crbug.com/995964 suggests that the core
issue relates to the assumption that device_start_request_queue_ can
only contain one occurrence of a controller while this might not be the
case.

This change makes sure that all occurrence of a controller are removed
from the list, instead of removing only the first found.

BUG=995964

Change-Id: Ice2a1da37d13339128d3d52d25daa252c5d61155
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1784726Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Armando Miraglia <armax@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694255}
parent a82509a5
...@@ -243,16 +243,14 @@ void VideoCaptureManager::DoStopDevice(VideoCaptureController* controller) { ...@@ -243,16 +243,14 @@ void VideoCaptureManager::DoStopDevice(VideoCaptureController* controller) {
// If start request has not yet started processing, i.e. if it is not at the // If start request has not yet started processing, i.e. if it is not at the
// beginning of the queue, remove it from the queue. // beginning of the queue, remove it from the queue.
auto request_iter = device_start_request_queue_.begin(); if (!device_start_request_queue_.empty()) {
if (request_iter != device_start_request_queue_.end()) { auto second_request = std::next(device_start_request_queue_.begin());
request_iter =
std::find_if(++request_iter, device_start_request_queue_.end(), for (auto it = second_request; it != device_start_request_queue_.end();) {
[controller](const CaptureDeviceStartRequest& request) { if (it->controller() == controller)
return request.controller() == controller; it = device_start_request_queue_.erase(it);
}); else
if (request_iter != device_start_request_queue_.end()) { ++it;
device_start_request_queue_.erase(request_iter);
return;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment