CODEC-313: Fix possible ArrayIndexOutOfBoundsException thrown by QuotedPrintableCodec.encodeQuotedPrintable() method#221
Merged
garydgregory merged 2 commits intoNov 25, 2023
Conversation
Member
|
@arthurscchan |
Contributor
Author
|
Hi, I have added the unit test. |
Member
|
@arthurscchan |
garydgregory
requested changes
Nov 24, 2023
garydgregory
left a comment
Member
There was a problem hiding this comment.
@arthurscchan
Please see my comment.
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
4769376 to
ad656e5
Compare
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
ad656e5 to
130dafc
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #221 +/- ##
=========================================
Coverage 92.27% 92.28%
- Complexity 1742 1743 +1
=========================================
Files 67 67
Lines 4584 4586 +2
Branches 709 710 +1
=========================================
+ Hits 4230 4232 +2
Misses 242 242
Partials 112 112 ☔ View full report in Codecov by Sentry. |
Member
|
@arthurscchan |
garydgregory
added a commit
that referenced
this pull request
Nov 25, 2023
…Codec.encodeQuotedPrintable() method #221
omosteven
pushed a commit
to omosteven/commons-codec-lab-work
that referenced
this pull request
Jan 8, 2025
…edPrintableCodec.encodeQuotedPrintable() method (apache#221) * CODEC-313: Fix possible ArrayIndexOutOfBoundsException Signed-off-by: Arthur Chan <arthur.chan@adalogics.com> * CODEC-313: Add unit test Signed-off-by: Arthur Chan <arthur.chan@adalogics.com> --------- Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
omosteven
pushed a commit
to omosteven/commons-codec-lab-work
that referenced
this pull request
Jan 8, 2025
…Codec.encodeQuotedPrintable() method apache#221
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/QuotedPrintableCodec.java thrown by
QuotedPrintableCodec.encodeQuotedPrintable()method when the input byte array has less than 3 elements.This PR adds a conditional check to ensure the index is never negative. It will simply return null if the byte array is too short (with a length less than 3) if strict value is true.
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=64358.