Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS1jMmhtLW1qeHYtODlyNM4AA1rG

Multiple soundness issues in lexical

lexical contains multiple soundness issues:

  1. Bytes::read() allows creating instances of types with invalid bit patterns
  2. BytesIter::read() advances iterators out of bounds
  3. The BytesIter trait has safety invariants but is public and not marked unsafe
  4. write_float() calls MaybeUninit::assume_init() on uninitialized data, which is is not allowed by the Rust abstract machine
  5. radix() calls MaybeUninit::assume_init() on uninitialized data, which is is not allowed by the Rust abstract machine

The crate also has some correctness issues.

Alternatives

For quickly parsing floating-point numbers third-party crates are no longer needed. A fast float parsing algorithm by the author of lexical has been merged into libcore.

For quickly parsing integers, consider atoi and btoi crates (100% safe code). atoi_radix10 provides even faster parsing, but only with -C target-cpu=native, and at the cost of some unsafe.

For formatting integers in a #[no_std] context consider the numtoa crate.

For working with big numbers consider num-bigint and num-traits.

Permalink: https://github.com/advisories/GHSA-c2hm-mjxv-89r4
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1jMmhtLW1qeHYtODlyNM4AA1rG
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Low
Classification: General
Published: about 1 year ago
Updated: 2 months ago


Identifiers: GHSA-c2hm-mjxv-89r4
References: Repository: https://github.com/Alexhuszagh/rust-lexical
Blast Radius: 0.0

Affected Packages

cargo:lexical
Dependent packages: 50
Dependent repositories: 2,108
Downloads: 13,771,113 total
Affected Version Ranges: <= 6.1.1
Fixed in: 7.0.0
All affected versions: 0.0.1, 1.0.0, 1.0.2, 1.0.3, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.5, 1.6.6, 1.6.7, 1.8.0, 1.8.2, 1.9.0, 1.9.1, 2.0.0, 2.1.0, 2.2.0, 2.2.1, 2.2.2, 2.2.4, 3.0.0, 3.0.1, 4.0.0, 4.1.0, 4.2.0, 4.2.1, 5.0.0, 5.1.0, 5.2.0, 5.2.1, 5.2.2, 6.0.0, 6.0.1, 6.1.0, 6.1.1
All unaffected versions: 7.0.0, 7.0.1, 7.0.2