Skip to content

Conversation

@nh13
Copy link
Owner

@nh13 nh13 commented Dec 22, 2025

Summary

  • Handles 'N' and unknown bases in insertion encoding that would cause bit overflow
  • Substitutes random base (matching behavior when bases=NULL) instead of silent corruption
  • Fixes both short insertions (line 318) and long insertions (line 350)

Fixes #108

Test plan

  • Unit tests pass (make test-unit)
  • Integration tests pass (make test-integration)

🤖 Generated with Claude Code

When nst_nt4_table returns 4 (for 'N' or unknown bases), the bit shift
can cause unexpected behavior:

1. In short insertions (line 318): value 4 encoded into 2-bit field
2. In long insertions (line 350): value 4 shifted by 0-6 bits can
   overflow uint8_t when bit_index=3 (4 << 6 = 256)

Fix: Check if base lookup returns >= 4 and substitute a random base,
consistent with the behavior when bases parameter is NULL.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Dec 22, 2025

Warning

Rate limit exceeded

@nh13 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 26 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 26e3aa9 and 672ef85.

📒 Files selected for processing (1)
  • src/mut.c
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/bit-shift-n-base

Comment @coderabbitai help to get the list of available commands and usage tips.

@nh13
Copy link
Owner Author

nh13 commented Dec 26, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Dec 26, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nh13
Copy link
Owner Author

nh13 commented Dec 26, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Dec 26, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nh13 nh13 merged commit dfe676b into main Dec 27, 2025
2 checks passed
@nh13 nh13 deleted the fix/bit-shift-n-base branch December 27, 2025 00:29
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.

fix: handle N base in bit-packed insertion encoding

2 participants