Harden base64 decode. #316

Merged
merged 1 commit into from Jul 25, 2016

Projects

None yet

1 participant

@dduponchel
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").

@dduponchel dduponchel Harden base64 decode.
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").
a8904f9
@dduponchel dduponchel merged commit b1156b5 into Stuk:master Jul 25, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@dduponchel dduponchel deleted the dduponchel:base64_decode branch Jul 25, 2016
@dduponchel dduponchel referenced this pull request Aug 2, 2016
Merged

Release v3.1.0 #326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment