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

fix buffer initialization in base64 encoding in node #75

Closed
wants to merge 2 commits into from
Closed

fix buffer initialization in base64 encoding in node #75

wants to merge 2 commits into from

Conversation

goto-bus-stop
Copy link
Contributor

If a number was passed to encode(), the buffer would be created with
uninitialised memory. This patch casts anything that's passed in to
a string first and then uses the safe Buffer.from API. Buffer.from
was added in Node v4 but the buffer-from module ponyfills it for older
Node versions.

See nodejs/node#4660

If a number was passed to `encode()`, the buffer would be created with
uninitialised memory. This patch casts anything that's passed in to
a string first and then uses the safe `Buffer.from` API. `Buffer.from`
was added in Node v4 but the `buffer-from` module ponyfills it for older
Node versions.

See [nodejs/node#4660](nodejs/node#4660)
@Acconut
Copy link
Member

Acconut commented May 30, 2017

Ouch, it hurts seeing such errors arise in JavaScript. Thank you a lot for solving this. Could you please address the one linting issue? https://travis-ci.org/tus/tus-js-client/jobs/237541799#L428

@goto-bus-stop
Copy link
Contributor Author

Done :)

Acconut added a commit that referenced this pull request May 30, 2017
commit 3827da752d3b2eb86613b92ffb6715806d799fdc
Author: Marius <maerious@gmail.com>
Date:   Tue May 30 21:31:26 2017 +0200

    Transpile changes

commit 025aac69f827e6c0f51215609070bab6b76cc491
Author: Marius <maerious@gmail.com>
Date:   Tue May 30 21:30:41 2017 +0200

    Add test for number metadata

commit 35b470af8386ff96230e09408a3ba83c6831b3a0
Merge: 902e4bf 74e4500
Author: Marius <maerious@gmail.com>
Date:   Tue May 30 21:26:52 2017 +0200

    Merge branch 'fix/buffer-leak' of https://github.com/goto-bus-stop/tus-js-client into buffer

commit 74e4500
Author: Renée Kooi <renee@kooi.me>
Date:   Tue May 30 17:18:44 2017 +0200

    fix lint

commit a420570
Author: Renée Kooi <renee@kooi.me>
Date:   Tue May 30 15:43:13 2017 +0200

    fix buffer initialization in base64 encoding

    If a number was passed to `encode()`, the buffer would be created with
    uninitialised memory. This patch casts anything that's passed in to
    a string first and then uses the safe `Buffer.from` API. `Buffer.from`
    was added in Node v4 but the `buffer-from` module ponyfills it for older
    Node versions.

    See [nodejs/node#4660](nodejs/node#4660)
@Acconut
Copy link
Member

Acconut commented May 30, 2017

Thank you, I added a test and merged in 66694b4

@Acconut Acconut closed this May 30, 2017
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

2 participants