RUSTSEC-2020-0059

Source
https://rustsec.org/advisories/RUSTSEC-2020-0059
Import Source
https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2020-0059.json
JSON Data
https://api.osv.dev/v1/vulns/RUSTSEC-2020-0059
Aliases
Published
2020-10-22T12:00:00Z
Modified
2023-11-08T04:03:38.548968Z
Severity
  • 4.7 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
MutexGuard::map can cause a data race in safe code
Details

Affected versions of the crate had a Send/Sync implementation for MappedMutexGuard that only considered variance on T, while MappedMutexGuard dereferenced to U.

This could of led to data races in safe Rust code when a closure used in MutexGuard::map() returns U that is unrelated to T.

The issue was fixed by fixing Send and Sync implementations, and by adding a PhantomData<&'a mut U> marker to the MappedMutexGuard type to tell the compiler that the guard is over U too.

Database specific
{
    "license": "CC0-1.0"
}
References

Affected packages

crates.io / futures-util

Package

Affected ranges

Type
SEMVER
Events
Introduced
0.3.2
Fixed
0.3.7

Ecosystem specific

{
    "affected_functions": null,
    "affects": {
        "os": [],
        "functions": [
            "futures_util::lock::MutexGuard::map"
        ],
        "arch": []
    }
}

Database specific

{
    "cvss": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H",
    "informational": null,
    "categories": [
        "thread-safety"
    ]
}