RUSTSEC-2026-0306: hex_decode_unchecked AVX2 path reads past src #26

Closed
opened 2026-09-25 00:08:52 +00:00 by gitea-actions · 0 comments

hex_decode_unchecked AVX2 path reads past src

Details
Status unsound
Package faster-hex
Version 0.10.0
URL https://github.com/nervosnetwork/faster-hex/issues/73
Date 2026-09-20

faster_hex::hex_decode_unchecked is a safe function. On x86 and x86_64, when AVX2 is enabled, hex_decode_avx2 keeps decoding while dst.len() >= 32 and then loads 32 bytes from src and 32 bytes from src[32..]. Nothing in that loop requires src to contain 64 bytes.

A safe caller can pass a short src and a dst of at least 32 bytes. The AVX2 load then reads outside src.

The function has had this shape since 0.3.0. 0.10.0 is the last release with the unbounded AVX2 read. The maintainer agreed to this advisory and shipped the backport in 0.10.1 (pull request 74): the AVX2 loop now requires src.len() >= 64 before those loads. 1.0.0 rewrites hex_decode_unchecked so the decoded length is min(src.len() / 2, dst.len()). Both are covered by >= 0.10.1. Other architectures take the scalar fallback and are outside this advisory.

See advisory page for additional details.

> `hex_decode_unchecked` AVX2 path reads past `src` | Details | | | ------------------- | ---------------------------------------------- | | Status | unsound | | Package | `faster-hex` | | Version | `0.10.0` | | URL | [https://github.com/nervosnetwork/faster-hex/issues/73](https://github.com/nervosnetwork/faster-hex/issues/73) | | Date | 2026-09-20 | `faster_hex::hex_decode_unchecked` is a safe function. On x86 and x86_64, when AVX2 is enabled, `hex_decode_avx2` keeps decoding while `dst.len() >= 32` and then loads 32 bytes from `src` and 32 bytes from `src[32..]`. Nothing in that loop requires `src` to contain 64 bytes. A safe caller can pass a short `src` and a `dst` of at least 32 bytes. The AVX2 load then reads outside `src`. The function has had this shape since 0.3.0. 0.10.0 is the last release with the unbounded AVX2 read. The maintainer agreed to this advisory and shipped the backport in 0.10.1 (pull request 74): the AVX2 loop now requires `src.len() >= 64` before those loads. 1.0.0 rewrites `hex_decode_unchecked` so the decoded length is `min(src.len() / 2, dst.len())`. Both are covered by `>= 0.10.1`. Other architectures take the scalar fallback and are outside this advisory. See [advisory page](https://rustsec.org/advisories/RUSTSEC-2026-0306.html) for additional details.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: infra/crete#26