Skip to content
OpenAdvisories
Low GHSA-j39j-6gw9-jw6h RUSTSEC-2026-0008

git2 has potential undefined behavior when dereferencing Buf struct

Published Feb 4, 2026 · Updated Sep 10, 2026 · Assigned by GHSA

Description

If the Buf struct is dereferenced immediately after calling new() or default() on the Buf struct, a null pointer is passed to the unsafe function slice::from_raw_parts. According to the safety section documentation of the function, data must be non-null and aligned even for zero-length slices or slices of ZSTs. Thus, passing a null pointer will lead to undefined behavior.

Affected packages

EcosystemPackageAffectedFixedRecord
crates.io git2 < 0.20.4 0.20.4 GHSA-j39j-6gw9-jw6h
crates.io git2 >= 0.0.0-0, < 0.20.4 0.20.4 RUSTSEC-2026-0008

References