Track vulnerabilities like this one.
Sign up free to get alerted when software you use is affected.
8.4
jp-ellis skiplist may crash with inconsistent comparator
published 29 days ago
Summary
The skiplist library can free memory it still uses if the function that compares items gives different answers for the same pair during a single operation. This can cause the program to stop working or behave unpredictably. Update to version 1.3.0 or later, which adds checks and prevents the unsafe behavior.
What to do
- Update jp-ellis skiplist to version 1.3.0.
Affected software
| Ecosystem | Vendor | Product | Affected versions |
|---|---|---|---|
| crates.io | jp-ellis | skiplist |
>= 0.0.0-0, < 1.3.0 Fix: upgrade to 1.3.0
|
Original advisory text
Use-after-free from a comparator that answers inconsistently
`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, so the
collection stays valid and safe to drop.
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, so the
collection stays valid and safe to drop.
References
- https://crates.io/crates/skiplist Product
- https://rustsec.org/advisories/RUSTSEC-2026-0409.html Vendor Advisory
- https://github.com/JP-Ellis/rust-skiplist/issues/401 Third Party Advisory
- https://github.com/JP-Ellis/rust-skiplist/pull/407 URL
Internet-facing
60 days
Internal
At next upgrade
- Not known to be exploited
- Needs hands-on effort to exploit (estimated)
- Gives an attacker partial control (estimated)
Timeline
Published24 Oct 2026
Updated26 Oct 2026
First seen26 Oct 2026
Track software like this
Free during beta