Aryan Ganjoo created IMAGING-389:
------------------------------------

             Summary: BinaryFunctions.searchQuad misses high-bit and 
overlapping byte sequences
                 Key: IMAGING-389
                 URL: https://issues.apache.org/jira/browse/IMAGING-389
             Project: Commons Imaging
          Issue Type: Bug
            Reporter: Aryan Ganjoo


BinaryFunctions.searchQuad(int, InputStream) misses byte sequences in two 
cases: a target with a byte >= 0x80 is compared against signed bytes, and a 
partial-match mismatch discards a byte that could begin the next match. For 
example, searching for 0xFFD8FFE0 in {0xFF,0xD8,0xFF,0xE0,7} fails; searching 
for "AAAB" in "AAAAB" also fails. Expected: both searches return after 
consuming exactly the matching four bytes. Actual: they consume to EOF and 
report no match.

A local regression check failed against pristine master 
0edbbafa28d4852c7789651cf561b0cd8698f315 and passed after replacing the 
reset-on-mismatch search with a four-byte sliding window. BinaryFunctionsTest 
and full mvn -q verify passed locally on the candidate. The patch is local and 
has not yet been submitted as a PR. This report is distinct from the existing 
BinaryFunctions issues found by searching the IMAGING Jira project.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to