CODEC-311: Fix possible ArrayIndexOutOfBoundException thrown by RefinedSoundex.getMappingCode()#219
Merged
garydgregory merged 3 commits intoNov 25, 2023
Conversation
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
Member
|
Hello @arthurscchan |
Contributor
Author
|
@garydgregory Thanks for the comment. I have added a unit test. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #219 +/- ##
============================================
- Coverage 92.27% 92.22% -0.05%
- Complexity 1742 1747 +5
============================================
Files 67 67
Lines 4584 4594 +10
Branches 709 714 +5
============================================
+ Hits 4230 4237 +7
- Misses 242 243 +1
- Partials 112 114 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
garydgregory
requested changes
Nov 22, 2023
9abdfbb to
e1fa662
Compare
Member
|
@arthurscchan |
e1fa662 to
0294b50
Compare
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
0294b50 to
f33a657
Compare
garydgregory
added a commit
that referenced
this pull request
Nov 25, 2023
…edSoundex.getMappingCode() #219
omosteven
pushed a commit
to omosteven/commons-codec-lab-work
that referenced
this pull request
Jan 8, 2025
…edSoundex.getMappingCode() (apache#219) * CODEC-311: Fix possible ArrayIndexOutOfBoundException Signed-off-by: Arthur Chan <arthur.chan@adalogics.com> * CODEC-311: Add unit test Signed-off-by: Arthur Chan <arthur.chan@adalogics.com> * Use final --------- Signed-off-by: Arthur Chan <arthur.chan@adalogics.com> Co-authored-by: Gary Gregory <garydgregory@users.noreply.github.com>
omosteven
pushed a commit
to omosteven/commons-codec-lab-work
that referenced
this pull request
Jan 8, 2025
…edSoundex.getMappingCode() apache#219
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes a possible ArrayIndexOutOfBoundException in src/main/java/org/apache/commons/codec/language/RefinedSoundex.java thrown by
RefinedSoundex.getMappingCode()method when handling out of range letters.This PR adds a conditional checking to ensure the index is never out of bounds from the configured soundexMapping array. If the calculated index goes out of bounds, it will simply return 0, just like the original logic when Character.isLetter() returns false.
We found this bug using fuzzing by way of OSS-Fuzz. It is reported at https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64353.