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 a crash in multipartBodyParser if mapping files array #1819 #1820

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

Conversation

guoyibj
Copy link

@guoyibj guoyibj commented Mar 16, 2020

Pre-Submission Checklist

  • [*] Opened an issue discussing these changes before opening the PR
  • [*] Ran the linter and tests via make prepush
  • [*] Included comprehensive and convincing tests for changes

Issues

Closes:

Crash in multipartBodyParser if mapping files array

Changes

Fix the crash issue and add test code.

});
});
}

barrier.start('fs' + f);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @guoyibj!

I'm not super familiar with this piece of code. But it looks like we are trying to flatten the array here. This if condition doesn't look like it returns and the following barrier is still run against f. Is that intentional?

Would it be possible to flatten files first? I.E. convert [f1, f2, [f3, [f4]]] to [f1, f2, f3, f4] to avoid the conditional logic here?

Copy link
Member

@ghermeto ghermeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @guoyibj, thank you for contributing.

If you always cast files[f] to an Array you avoid have two code paths.

I also tried to run the tests without your changed and they passed. Could you include tests that will fail without your changes?

@guoyibj
Copy link
Author

guoyibj commented Jun 30, 2020

@ghermeto Test script in my MR is not suitable, I attached the reproducible projects in the ticket #1819, can you please download testServer.zip and testClient.zip and try them?

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

3 participants