HhH666-ux commented on issue #16451:
URL: https://github.com/apache/dubbo/issues/16451#issuecomment-6459534281

   Picked this up — PR #16543 is open for review.
   
   Root cause: `getMD5(InputStream, int)` hashed the whole buffer via 
`md.update(buf)` instead of the `total` bytes actually read, so the final chunk 
of any stream whose length is not a multiple of the 8 KiB buffer hashed stale 
tail bytes from the previous chunk. The outer loop was also gated on 
`available() > 0`, which returns the digest of an empty input for streams that 
short-read (`FileInputStream` on network mounts and encrypted volumes, which is 
what `getMD5(File)` forwards to).
   
   The PR hashes only the bytes read and drops the `available()` gate; the 
stale expectation in `BytesTest.testMD5ForFile` is corrected to the real 
digest. CI is green (32 checks).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to