{
  "schema_version": "1.4.0",
  "id": "GHSA-3h87-v52r-p9rg",
  "modified": "2023-06-13T20:27:27Z",
  "published": "2021-08-25T20:54:08Z",
  "aliases": [
    "CVE-2021-29941"
  ],
  "summary": "Out of bounds write in reorder",
  "details": "swap_index takes an iterator and swaps the items with their corresponding indexes. It reserves capacity and sets the length of the vector based on the .len() method of the iterator.\n\nIf the len() returned by the iterator is larger than the actual number of elements yielded, then swap_index creates a vector containing uninitialized members. If the len() returned by the iterator is smaller than the actual number of members yielded, then swap_index can write out of bounds past its allocated vector.\n\nAs noted by the Rust documentation, len() and size_hint() are primarily meant for optimization and incorrect values from their implementations should not lead to memory safety violations.",
  "severity": [
    {
      "type": "CVSS_V3",
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
    }
  ],
  "affected": [
    {
      "package": {
        "ecosystem": "crates.io",
        "name": "reorder"
      },
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.1.0"
            }
          ]
        }
      ]
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2021-29941"
    },
    {
      "type": "WEB",
      "url": "https://github.com/tiby312/reorder/issues/1"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/tiby312/reorder"
    },
    {
      "type": "WEB",
      "url": "https://rustsec.org/advisories/RUSTSEC-2021-0050.html"
    }
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-787"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2021-08-19T17:17:20Z",
    "nvd_published_at": null
  }
}