Skip to content

RUSTSEC-2026-0008: Potential undefined behavior when dereferencing Buf struct #3138

@github-actions

Description

@github-actions

Potential undefined behavior when dereferencing Buf struct

Details
Status unsound
Package git2
Version 0.18.3
URL rust-lang/git2-rs#1213
Date 2026-02-02

if we dereference the Buf struct right after calling new() or default() on Buf struct, it passes Null Pointer to the unsafe function slice::from_raw_parts. Based on the safety section documentation of function,
data must be non-null and aligned even for zero-length slices or slices of ZSTs. Thus, passing Null Pointer will lead to undefined behavior.

See advisory page for additional details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions