Skip to content

fix(tashfeer): prevent infinite loop and event loop hang on invalid levels (fix #35) - #36

Merged
AbdelrahmanBayoumi merged 1 commit into
mainfrom
fix/35-tashfeer-nontermination
Oct 18, 2026
Merged

AbdelrahmanBayoumi merged 1 commit into
mainfrom
fix/35-tashfeer-nontermination

Conversation

@AbdelrahmanBayoumi

Copy link
Copy Markdown
Member

Closes #35

Summary of Changes:

  • Added validateTashfeerLevel to validate input encryption levels across tashfeer, tashfeerBannedWords, and toOldArabicAndTashfeerBannedWords.
  • Guards getRandomIndexes with bounded index sampling (randomIndexes.size < count) and handles boundary cases (wordLength <= 0).
  • Prevents infinite loops / Event Loop lockups caused by negative, fractional, or non-finite numbers.
  • Added comprehensive unit tests in tests/edge-cases.test.ts covering edge cases, invalid inputs, and performance boundaries.
  • All 80 tests passing, linting clean, and TypeScript checks pass.

@AbdelrahmanBayoumi AbdelrahmanBayoumi self-assigned this Oct 18, 2026
@AbdelrahmanBayoumi
AbdelrahmanBayoumi merged commit 7d89bb5 into main Oct 18, 2026
4 checks passed
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(tashfeer): prevent infinite loop and event loop hang on invalid levels

1 participant