This repository has been archived by the owner on Aug 29, 2023. It is now read-only.
generated from IBM/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix panic out of range when index map gets out of sync with normaliza…
…tion text (#27) * Create IndexMap after ToLower(). Ensure this and initialize() are only done once. Protect from out of range. Index out of range errors can happen when the Normalized Text gets longer than the IndexMap. This was happening when ToLower() was increasing the size of NormalizedText after the IndexMap creation. Initialize was also resetting NormalizedText when called after normalization shrunk the text to "". * ToLower() is now part of initialize() * initialize is now only called once, as needed, protected by sync. * The out of range exposures are also now protected. * ToLower() is now before some matchers that were using unnecessary case-insensitive matching. Those are now optimized to assume lower. Fixes #26 Signed-off-by: Mark Sturdevant <[email protected]> * Remove unused var Signed-off-by: Mark Sturdevant <[email protected]> Signed-off-by: Mark Sturdevant <[email protected]>
- Loading branch information
Showing
2 changed files
with
62 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters