GHSA-68p4-pjpf-xwcq

Suggest an improvement
Source
https://github.com/advisories/GHSA-68p4-pjpf-xwcq
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/05/GHSA-68p4-pjpf-xwcq/GHSA-68p4-pjpf-xwcq.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-68p4-pjpf-xwcq
Aliases
Published
2022-05-24T17:41:47Z
Modified
2023-11-08T04:05:23.024619Z
Severity
  • 5.3 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L CVSS Calculator
Summary
insert_slice_clone can double drop if Clone panics.
Details

Affected versions of this crate used ptr::copy when inserting into the middle of a Vec. When ownership was temporarily duplicated during this copy, it calls the clone method of a user provided element.

This issue can result in an element being double-freed if the clone call panics.

Commit 20cb73d fixed this issue by adding a set_len(0) call before operating on the vector to avoid dropping the elements during a panic.

Database specific
{
    "nvd_published_at": "2021-02-09T23:15:00Z",
    "cwe_ids": [
        "CWE-415"
    ],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2022-06-17T00:14:33Z"
}
References

Affected packages

crates.io / qwutils

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.3.1

Ecosystem specific

{
    "affected_functions": [
        "qwutils::imp::vec::VecExt::insert_slice_clone"
    ]
}