Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions crates/fourq/RUSTSEC-0000-0000.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
```toml
[advisory]
id = "RUSTSEC-0000-0000"
package = "fourq"
date = "2026-05-02"
url = "https://github.com/982945902/fourq_rust/issues/1"
informational = "unsound"
categories = ["memory-corruption"]
keywords = ["undefined-behavior", "out-of-bounds"]

[versions]
patched = []
```

# Out-of-bounds pointer arithmetic and write in `Point::from_hash()`

`Point::from_hash()` performs unchecked pointer arithmetic on the input byte
slice. It casts `bytes.as_ptr()` to `*mut [u64; 2]`, adds 1 to get `r1`, and
calls `mod1271()` on both `r0` and `r1` without validating that
`bytes.len() >= 32`. With a short slice (e.g. 4 bytes), `r0.add(1)` produces
an out-of-bounds pointer, leading to out-of-bounds memory writes.

The function also casts a `const` pointer to `mut` and mutates the caller's
slice, violating the aliasing rules.

This is undefined behavior that can be triggered through a public safe API —
no `unsafe` is required from the caller's perspective.