Skip to content

DST: bitmap edge cases — large offsets and SETBIT-then-GETBIT sequences #8

@nerdsane

Description

@nerdsane

Context

Found during DST methodology review of bitmap implementation (commit e9be18b).

Problems

  1. Offset range too narrow: DST generates offsets 0-2047 but never tests near MAX_BIT_OFFSET (4,294,967,296). Should occasionally test boundary offsets and large allocations (~125KB for offset 1,000,000).

  2. No explicit read-after-write test: No SETBIT-then-GETBIT sequence on the same key+offset. Relies on random interleaving which is rare at 5% probability.

  3. Bitmap in final else clause: Fragile if new string ops are added above — bitmap coverage could silently drop to zero.

Suggested Fix

  • 5% of bitmap ops: use rng.gen_range(0, MAX_BIT_OFFSET + 100) for boundary testing
  • After each SETBIT, do a verification GETBIT on the same key+offset
  • Consider a named constant for the bitmap threshold instead of relying on else

Severity

Low — coverage gap, not a correctness bug.

Found By

DST review agent (Issues 3, 5, 6)

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