Skip to content

Reject out-of-range ints instead of truncating - #302

Merged
KeiaiLab-PHIL merged 1 commit into
mainfrom
fix/int-conversion-bounds
Oct 6, 2026
Merged

KeiaiLab-PHIL merged 1 commit into
mainfrom
fix/int-conversion-bounds

Conversation

@KeiaiLab-PHIL

Copy link
Copy Markdown
Contributor

CodeQL go/incorrect-integer-conversion flagged two narrowing casts
that silently wrap:

  • sourceShardPodDNS: "shard-4294967296" became ordinal 0 and pointed
    the copy Job at shard-0's primary.
  • parseHashBound: "0x100000000" became 0, so a ShardRange bound
    could cover a different hash range than written.

Parse with bitSize 32 so out-of-range input returns an error. Add
boundary table tests.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Signed-off-by: phil phil@keiailab.com

🤖 Generated with Claude Code

CodeQL go/incorrect-integer-conversion flagged two narrowing casts
that silently wrap:

- sourceShardPodDNS: "shard-4294967296" became ordinal 0 and pointed
  the copy Job at shard-0's primary.
- parseHashBound: "0x100000000" became 0, so a ShardRange bound
  could cover a different hash range than written.

Parse with bitSize 32 so out-of-range input returns an error. Add
boundary table tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: phil <phil@keiailab.com>
@KeiaiLab-PHIL
KeiaiLab-PHIL enabled auto-merge (squash) October 6, 2026 01:47
@KeiaiLab-PHIL
KeiaiLab-PHIL merged commit ae90469 into main Oct 6, 2026
4 checks passed
@KeiaiLab-PHIL
KeiaiLab-PHIL deleted the fix/int-conversion-bounds branch October 6, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant