Skip to content

TigerStyle: unchecked arithmetic in SDS::append() #6

@nerdsane

Description

@nerdsane

Context

Found during code review of bitmap implementation (commit e9be18b).

Problem

src/redis/data/sds.rs:203 uses raw + in append():

let new_len = self.len() + other.len();

TigerStyle requires checked_add on all computed integers. While realistic Redis values cannot overflow usize on 64-bit (512MB limit), the convention requires explicit checked arithmetic.

Fix

let new_len = self.len().checked_add(other.len())
    .ok_or_else(|| /* return error or use expect with documented reason */)?;

Severity

Medium — pre-existing, not introduced by bitmap commits.

Found By

TigerStyle review agent (Issue 5)

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