GHSA-rh4w-94hh-9943

Suggest an improvement
Source
https://github.com/advisories/GHSA-rh4w-94hh-9943
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/05/GHSA-rh4w-94hh-9943/GHSA-rh4w-94hh-9943.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-rh4w-94hh-9943
Aliases
Published
2022-05-24T17:37:49Z
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.

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": [
        "futures_util::lock::MutexGuard::map"
    ]
}