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

Add input size check to update() method #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VictorColomb
Copy link

In response to #18.

Add a check on the input size of the Blake2b.prototope.update() method.

assert(input.length + head <= 65536000, 'input + head must be of size 65,536,000 or less')

Reason

The WebAssembly instance memory is limited to 65,536,000 bytes (64 * 1,000 KiB) because of the following:

(memory (export "memory") 10 1000)

Therefore, the memory can only grow to this size, and the update() method fails when input.length + head > 65536000.

@VictorColomb
Copy link
Author

Ping @mafintosh

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