• Ovidio Henriquez's avatar
    Fix OOB in OnBluetoothScanningPromptEvent · 405c0146
    Ovidio Henriquez authored
    This changes fixes an OOB access that may occur in
    WebBluetoothServiceImpl::OnBluetoothScanningPromptEvent(). The method
    assumes that |scanning_clients_| will be populated when the method is
    called, however it can be cleared if a Mojo connection error is
    triggered.
    
    The method now returns if |scanning_clients_| is empty, and it uses the
    back() and pop() methods of vector to further prevent accidental OOB
    access. Additionally, in BluetoothDeviceScanningPromptController, the
    EventHandler binding is updated so that the lifetime of the class is
    associated with the binding.
    
    Bug: 1024116
    Change-Id: I2008f7bc1ce65be1d94d39370ac8593f5ff418e8
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916686
    Commit-Queue: Ovidio de Jesús Ruiz-Henríquez <odejesush@chromium.org>
    Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#715472}
    405c0146
bluetooth_device_scanning_prompt_controller.cc 2.23 KB