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

Harden base64 decode. #316

Merged
merged 1 commit into from
Jul 25, 2016
Merged

Harden base64 decode. #316

merged 1 commit into from
Jul 25, 2016

Conversation

dduponchel
Copy link
Collaborator

A common mistake is to put a data url (from a canvas for example) as a base64
content. In that case, we got a float value as the computed length of the
result and creating an Uint8Array threw an error.

This commit hardens the base64 decode: if the computed length is not an
integer or if the content looks like a data url, a better error is
thrown (instead of "TypeError: invalid arguments").

A common mistake is to put a data url (from a canvas for example) as a base64
content. In that case, we got a float value as the computed length of the
result and creating an Uint8Array threw an error.

This commit hardens the base64 decode: if the computed length is not an
integer or if the content looks like a data url, a better error is
thrown (instead of "TypeError: invalid arguments").
@dduponchel dduponchel merged commit b1156b5 into Stuk:master Jul 25, 2016
@dduponchel dduponchel deleted the base64_decode branch July 25, 2016 20:13
@dduponchel dduponchel mentioned this pull request Aug 2, 2016
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.

None yet

1 participant