Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #685 | Fix StringIndexOutOfBoundsException in ICC DESC tag processing #687

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

DAN-MU-ZI
Copy link
Contributor

This PR resolves an issue where malformed ICC profiles could trigger a
StringIndexOutOfBoundsException during the processing of the DESC tag.

  • Validates stringLength to ensure it is not negative and does not exceed
    bytes.length - 12.
  • Throws a BufferBoundsException with a detailed message for invalid cases.
  • Ensures the library gracefully handles corrupted ICC profiles.

This fix improves robustness in handling ICC metadata and prevents crashes
caused by malformed data.

…nt exceptions

Resolved an issue where malformed ICC profiles could cause a
StringIndexOutOfBoundsException during DESC tag processing.

- Added validation to ensure `stringLength` is non-negative and does not
  exceed `bytes.length - 12`.
- Throws `BufferBoundsException` with a detailed message for invalid cases.
- Ensures corrupted ICC profiles are handled gracefully.
Copy link
Owner

@drewnoakes drewnoakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great change, thank you!

@drewnoakes drewnoakes linked an issue Nov 26, 2024 that may be closed by this pull request
@drewnoakes drewnoakes linked an issue Nov 26, 2024 that may be closed by this pull request
@drewnoakes drewnoakes merged commit 3db5330 into drewnoakes:main Nov 26, 2024
5 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.

java.lang.StringIndexOutOfBoundsException processing a .JPG file
2 participants