Skip to content

[IMAGING-389] Fix searchQuad byte matching - #562

Open
AryanRG wants to merge 1 commit into
apache:masterfrom
AryanRG:IMAGING-389-searchquad-byte-matching
Open

AryanRG wants to merge 1 commit into
apache:masterfrom
AryanRG:IMAGING-389-searchquad-byte-matching

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 18, 2026

Copy link
Copy Markdown

Summary

BinaryFunctions.searchQuad compares signed Java bytes with unsigned InputStream.read() values and drops a partial match when the mismatching byte could start the next match. This can miss a quad containing high-bit bytes or an overlapping prefix.

Use a four-byte sliding window to compare the complete sequence. Add regressions for high-bit bytes, overlapping matches, short/non-matching streams, and the stream position after a match. Add an IMAGING-389 change entry.

Jira: https://issues.apache.org/jira/browse/IMAGING-389

Validation

  • Focused BinaryFunctionsTest and full mvn -q verify passed locally.
  • The default Maven build (mvn) previously passed on the same final file tree; a fresh mvn -q run also passed.

Contributor checklist

  • Read the project contribution guidelines.
  • Read the ASF Generative Tooling Guidance.
  • AI assistance used: Kiro Opus 5.5 helped identify the defect, prepare the code and tests, and perform an independent automated review. The Maven results above were checked locally.
  • Run the default Maven build.
  • Add unit tests for the behavioral change.
  • Explain the what, how, and why of the change.
  • Use a meaningful issue-linked commit subject and body.

Use a four-byte sliding window so high-bit bytes and overlapping partial matches are found. Add focused regressions and an issue-linked change note.
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.

1 participant