Skip to content

diffguard-analytics/lib.rs:228,281: usize→u32 truncation on 64-bit targets (unchecked cast) #577

@EffortlessSteven

Description

@EffortlessSteven

Location: and

Clippy lint: /

Both lines cast to without checked conversion:

On 64-bit targets (the default on x86_64 Linux/macOS/Windows), is 64 bits while is 32 bits. If either collection exceeds entries, the cast silently truncates. While (≈4.3B) is large, build artifacts or very long analysis runs could plausibly exceed this.

Fix: Use for these fields in the analytics schema, or use / to handle overflow explicitly.

Existing issues: Issue #545 covers a similar truncation in but is specifically about . These analytics fields are independent and not yet addressed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions