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

ArrayIndexOutOfBoundsException at System.arraycopy in Blake2spDigest update method for message length 1007 bytes #1363

Closed
jonelo opened this issue Mar 26, 2023 · 2 comments

Comments

@jonelo
Copy link

jonelo commented Mar 26, 2023

When hashing a message length of 1007 bytes with Blake2spDigest I got the following exception:

java.lang.ArrayIndexOutOfBoundsException: arraycopy: last destination index 495 out of bounds for byte[256]

I figured out that in that case the arraycopy call failed at line 102 at

            System.arraycopy(message, offset, buffer, left, len);

because of the values offset=512, buffer.length=256, left=0, and len=495

jonelo added a commit to jonelo/bc-java that referenced this issue Mar 26, 2023
@jonelo
Copy link
Author

jonelo commented Mar 26, 2023

a possible fix would be to increase the buffer size to 512 bytes as in commit jonelo@cdaf22c

@dghgit
Copy link
Contributor

dghgit commented Apr 12, 2023

Fixed in 1.73

@dghgit dghgit closed this as completed Apr 12, 2023
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

No branches or pull requests

2 participants