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

Crash on empty file upload #21

Closed
Ezwal opened this issue Nov 10, 2017 · 4 comments
Closed

Crash on empty file upload #21

Ezwal opened this issue Nov 10, 2017 · 4 comments

Comments

@Ezwal
Copy link

Ezwal commented Nov 10, 2017

Using busboy and busboy-body-parser and node major version 7 and above, the application crash when dealing with an empty payload. The error thrown stems from the measure of the piped file buffer length Buffer.byteLength(d, 'binary') (index.js l.51).
The major change to Buffer break the module since d is an empty array it cause the error :
TypeError: "string" must be a string, Buffer, or ArrayBuffer. Retrograding works since the line is working before #18

@lennym
Copy link
Owner

lennym commented Nov 10, 2017

@Ezwal Thanks for opening this. I'll take a look asap.

@lennym
Copy link
Owner

lennym commented Nov 10, 2017

@Ezwal Are you able to provide a minimal test case or steps to reproduce, ideally a curl command, that I can use to replicate this. I'm just trying to get an idea of what conditions would cause the payload to be empty, but still cause busboy to trigger a file event.

No problem if not, it'll just speed up the resolution if I don't have to reverse engineer it myself.

Edit: It was easier than I expected.

@lennym lennym closed this as completed in cb53f58 Nov 10, 2017
lennym added a commit that referenced this issue Nov 10, 2017
Fix #21 - prevent crash on empty payload
@lennym
Copy link
Owner

lennym commented Nov 10, 2017

Fix published at v0.3.1. Let me know if that solves your issues.

Thanks for your help.

@Ezwal
Copy link
Author

Ezwal commented Nov 10, 2017

it works fine now, thank you for the very quick response !

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