Skip to content
Heist/ feed
Back to feed
MediumFix available

Use-after-free from a comparator that answers inconsistently

Type: advisorySources: OSV

`OrderedSkipList`, `SkipSet` and `SkipMap` can free a node that is still linked when a `Comparator` or `Ord` implementation gives different answers for the same pair of values during one mutating call. A later call reads the freed memory (CWE-416). A safe `impl Ord` with the default comparator is enough to reach it. The mutating traversals record a precursor at each level: the last node whose link points at a node comparing not-`Less` than the target. The splice code assumes every recorded precursor's link points at or past the final position. If a later comparison reports one of those nodes as `Less`, the walk steps past it and the assumption breaks. Removals such as `take_first`, `take` and `remove` then rewire the wrong link and free the target while its real predecessor still points at it. `insert` builds crossed links and wrong skip distances from the same precursors. A comparator that is a pure function of its two arguments cannot trigger this, even if it is not transitive. The trigger is a stateful or non-deterministic implementation, for example one that reads a counter, a cache, a clock or a random source. The flaw was corrected in 1.3.0. The mutating traversals track the link target of the lowest recorded precursor and panic with "comparator does not implement a total order" when a `Less` answer contradicts an earlier one. Every splice site also checks its precursors before the first write. Each detected contradiction panics before any link, value or length changes,

Products
skiplist
Affected versions
Not specified
Fixed versions
1.3.0
CVEs
Not specified
Confirmed fixed CVEs
Not specified
Updated in this feed
1 Nov 2026, 14:47 UTC · Revision 1

Source evidence

Use-after-free from a comparator that answers inconsistently

core-osv · Original source

Published 24 Oct 2026, 12:00 UTC

`OrderedSkipList`, `SkipSet` and `SkipMap` can free a node that is still linked when a `Comparator` or `Ord` implementation gives different answers for the same pair of values during one mutating call. A later call reads the freed memory (CWE-416). A safe `impl Ord` with the default comparator is enough to reach it. The mutating traversals record a precursor at each level: the last node whose link points at a node comparing not-`Less` than the target. The splice code assumes every recorded precursor's link points at or past the final position. If a later comparison reports one of those nodes as `Less`, the walk steps past it and the assumption breaks. Removals such as `take_first`, `take` and `remove` then rewire the wrong link and free the target while its real predecessor still points at it. `insert` builds crossed links and wrong skip distances from the same precursors. A comparator that is a pure function of its two arguments cannot trigger this, even if it is not transitive. The trigger is a stateful or non-deterministic implementation, for example one that reads a counter, a cache, a clock or a random source. The flaw was corrected in 1.3.0. The mutating traversals track the link target of the lowest recorded precursor and panic with "comparator does not implement a total order" when a `Less` answer contradicts an earlier one. Every splice site also checks its precursors before the first write. Each detected contradiction panics before any link, value or length changes,

osv:RUSTSEC-2026-0409

skiplist

Fixed versions: 1.3.0

Complete source record
{
  "id": "46146287cf0d4031094acf0ae649dfcd2f1e6da1689df6e36dded1becaea3130",
  "url": "https://osv.dev/vulnerability/RUSTSEC-2026-0409",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Use-after-free from a comparator that answers inconsistently",
    "summary": "`OrderedSkipList`, `SkipSet` and `SkipMap` can free a node that is still linked when a `Comparator` or `Ord` implementation gives different answers for the same pair of values during one mutating call. A later call reads the freed memory (CWE-416). A safe `impl Ord` with the default comparator is enough to reach it. The mutating traversals record a precursor at each level: the last node whose link points at a node comparing not-`Less` than the target. The splice code assumes every recorded precursor's link points at or past the final position. If a later comparison reports one of those nodes as `Less`, the walk steps past it and the assumption breaks. Removals such as `take_first`, `take` and `remove` then rewire the wrong link and free the target while its real predecessor still points at it. `insert` builds crossed links and wrong skip distances from the same precursors. A comparator that is a pure function of its two arguments cannot trigger this, even if it is not transitive. The trigger is a stateful or non-deterministic implementation, for example one that reads a counter, a cache, a clock or a random source. The flaw was corrected in 1.3.0. The mutating traversals track the link target of the lowest recorded precursor and panic with \"comparator does not implement a total order\" when a `Less` answer contradicts an earlier one. Every splice site also checks its precursors before the first write. Each detected contradiction panics before any link, value or length changes,",
    "evidence": "osv:RUSTSEC-2026-0409",
    "products": [
      {
        "name": {
          "value": "skiplist",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "1.3.0",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "medium",
    "structured": {
      "id": "RUSTSEC-2026-0409",
      "aliases": [
        "GHSA-cc53-p78w-23w9",
        "RUSTSEC-2026-0409"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "0.0.0-0"
                },
                {
                  "fixed": "1.3.0"
                }
              ]
            }
          ],
          "package": {
            "name": "skiplist",
            "purl": "pkg:cargo/skiplist",
            "ecosystem": "crates.io"
          },
          "database_specific": {
            "cvss": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N",
            "source": "https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0409.json",
            "categories": [
              "memory-corruption"
            ],
            "informational": null
          },
          "ecosystem_specific": {
            "affects": {
              "os": [],
              "arch": [],
              "functions": []
            },
            "affected_functions": null
          }
        }
      ],
      "modified": "2026-10-26T14:00:04.241377560Z",
      "provider": "osv",
      "references": [
        "https://crates.io/crates/skiplist",
        "https://rustsec.org/advisories/RUSTSEC-2026-0409.html",
        "https://github.com/JP-Ellis/rust-skiplist/issues/401",
        "https://github.com/JP-Ellis/rust-skiplist/pull/407"
      ],
      "provider_metadata": {
        "license": "CC0-1.0"
      }
    },
    "related_cves": [],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 454184,
  "published_at": "2026-10-24T12:00:00+00:00"
}