{"id":"CVE-2021-29941","aliases":["EUVD-2021-1545","GHSA-3h87-v52r-p9rg","GHSA-jpwg-6gf5-5vh9","RUSTSEC-2021-0050"],"status":"published","title":"Out of bounds write in reorder","description":"An issue was discovered in the reorder crate through 2021-02-24 for Rust. swap_index has an out-of-bounds write if an iterator returns a len() that is too small.","severity":{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-10","score":0.00932,"percentile":0.60997,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-787"],"published":"2021-02-24T12:00:00Z","modified":"2026-06-17T03:48:28Z","fixes":[{"ecosystem":"crates.io","package":"reorder","fixed_in":["1.1.0"],"sources":["ghsa"]}],"affected":[{"source":"ghsa","ecosystem":"crates.io","package":"reorder","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.1.0"}]}]},{"source":"osv","ecosystem":"crates.io","package":"reorder","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.1.0"}]}],"bundled":2},{"source":"osv","ecosystem":"crates.io","package":"reorder","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.1.0"}]}],"bundled":2},{"source":"osv","ecosystem":"crates.io","package":"reorder","ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"1.1.0"}]}],"bundled":2}],"products":[{"vendor":"reorder_project","product":"reorder"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0050.html","tags":["x_refsource_MISC","x_transferred","Exploit","Vendor Advisory","web","advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-29941","tags":["advisory"]},{"url":"https://github.com/tiby312/reorder/issues/1","tags":["web","report"]},{"url":"https://github.com/advisories/GHSA-3h87-v52r-p9rg"},{"url":"https://github.com/tiby312/reorder","tags":["package"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-29942","tags":["advisory"]},{"url":"https://crates.io/crates/reorder","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2021-29941","description":"An issue was discovered in the reorder crate through 2021-02-24 for Rust. swap_index has an out-of-bounds write if an iterator returns a len() that is too small.","status":"published","published":"2021-04-01T04:22:39Z","modified":"2024-08-03T22:18:03.411Z","updated_at":"2026-11-02T14:33:06.658806Z"}],"euvd":[{"id":"EUVD-2021-1545","description":"An issue was discovered in the reorder crate through 2021-02-24 for Rust. swap_index has an out-of-bounds write if an iterator returns a len() that is too small.","status":"published","published":"2021-04-01T04:22:39Z","modified":"2024-08-03T22:18:03Z","updated_at":"2026-11-03T03:24:43.965438Z"}],"ghsa":[{"id":"GHSA-3h87-v52r-p9rg","title":"Out of bounds write in reorder","description":"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.","status":"published","published":"2021-08-25T20:54:08Z","modified":"2023-06-13T20:27:28Z","cvss":[{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high"}],"cwes":["CWE-787"],"updated_at":"2026-11-02T14:36:54.225318Z"}],"nvd":[{"id":"CVE-2021-29941","description":"An issue was discovered in the reorder crate through 2021-02-24 for Rust. swap_index has an out-of-bounds write if an iterator returns a len() that is too small.","status":"published","published":"2021-04-01T05:15:14.967Z","modified":"2026-06-17T03:48:28.89Z","cvss":[{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high","assessor":"primary"},{"version":"2.0","score":7.5,"vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","level":"high","assessor":"primary"}],"cwes":["CWE-787"],"updated_at":"2026-11-02T14:06:51.197859Z"}],"osv":[{"id":"GHSA-3h87-v52r-p9rg","title":"Out of bounds write in reorder","description":"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.","status":"published","published":"2021-08-25T20:54:08Z","modified":"2023-11-08T04:05:44.188314Z","cvss":[{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high"}],"cwes":["CWE-787"],"updated_at":"2026-11-02T15:46:35.747385Z"},{"id":"GHSA-jpwg-6gf5-5vh9","title":"Out of bounds write in reorder","description":"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.\n","status":"published","published":"2021-08-25T20:54:10Z","modified":"2023-11-08T04:05:44.188314Z","cvss":[{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high"}],"cwes":["CWE-787"],"updated_at":"2026-11-02T15:46:50.687609Z"},{"id":"RUSTSEC-2021-0050","title":"swap_index can write out of bounds and return uninitialized memory","description":"`swap_index` takes an iterator and swaps the items with their corresponding\nindexes. It reserves capacity and sets the length of the vector based on the\n`.len()` method of the iterator.\n\nIf the `len()` returned by the iterator is larger than the actual number of\nelements yielded, then `swap_index` creates a vector containing uninitialized\nmembers. If the `len()` returned by the iterator is smaller than the actual\nnumber of members yielded, then `swap_index` can write out of bounds past\nits allocated vector.\n\nAs noted by the Rust documentation, [`len()`](https://doc.rust-lang.org/std/iter/trait.ExactSizeIterator.html#method.len)\nand `size_hint()` are primarily meant for optimization and incorrect values\nfrom their implementations should not lead to memory safety violations.\n\n\n# Patch\n\nA new version crate was pushed that marks this function as unsafe.\n\nreorder = \"1.1.0\"\n\nPrevious versions have also been yanked from crates.io.","status":"published","published":"2021-02-24T12:00:00Z","modified":"2023-11-08T04:05:44.188314Z","cvss":[{"version":"3.1","score":7.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","level":"high"}],"updated_at":"2026-11-02T15:53:39.492624Z"}]}}
