• Bruce Dawson's avatar
    Fix invalid handle errors found with App Verifier · c31de326
    Bruce Dawson authored
    ChildProcessData was holding a raw ProcessHandle which meant that there
    was no guarantee that the handle would be valid when it was used. This
    change switches to a ScopedHandle on Windows, with the associated
    duplication of the handle, so that it is guaranteed to be valid. This
    fixes a frequently encountered use of an invalid handle that was
    detected by Application Verifier. This change also adds a CHECK to
    base::GetProcId to check for use of invalid handles even when not using
    Application Verifier.
    
    ChildProcessData::handle is now a private member so all references to
    it were updated to use accessors.
    
    When ChildProcessData::SetHandle is called the handle is duplicated.
    When a ChildProcessData object needs to be copied an explicit
    Duplicate function is called.
    
    An IsHandleValid helper function was added.
    
    An invalid test was removed because it was triggering the CHECK in
    base::GetProcId.
    
    Bug: 417532,821453,865805
    Change-Id: I7e38140335c0140536919341f011f144f150c88f
    Reviewed-on: https://chromium-review.googlesource.com/1145767
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#578419}
    c31de326
chrome_content_browser_client_browsertest_chromeos.cc 2.99 KB