Skip to content

fix: prevent multiplication overflow in search limit calculation#30

Open
echobt wants to merge 1 commit intomainfrom
fix/issue-126
Open

fix: prevent multiplication overflow in search limit calculation#30
echobt wants to merge 1 commit intomainfrom
fix/issue-126

Conversation

@echobt
Copy link
Copy Markdown
Contributor

@echobt echobt commented Jan 20, 2026

Description

This PR fixes a potential panic caused by integer overflow when multiplying max_results by 3 in search queries.

Changes

  • Changed multiplication to saturating_mul in src/core/search.rs and src/core/db.rs.
  • Added a regression test case in src/core/db.rs to verify the fix works for large limit values.

Verification

  • Ran cargo test and verified the new test case passes.
  • Verified that existing functionality is preserved.

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