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

Adding rail guard to dispatch's event param #3140

Closed
wants to merge 1 commit into from
Closed

Adding rail guard to dispatch's event param #3140

wants to merge 1 commit into from

Conversation

Chopinsky
Copy link

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behaviour

When event packet received by onevent doesn't contain a valid array as the value of the data property, the subsequent call to dispatch will cause a TypeError, because the apply call on emit would expect the 2nd parameter to be an array type.

New behaviour

Now if event packet's data property is not already an array, we will convert it to an array before passing it to the apply call, to avoid the TypeError exception on rare occurrence of the problem as raised in issue #3139.

Other information (e.g. related issues)

There seem to be quite a few other places that would use a similar array type check in socket.js, but would rather hold off on updating all these places until further reporting of the TypeError exceptions.

@grajagandev
Copy link

Would you be interested in software that automatically finds TypeErrors like this? I am building Fuzz Stati0n to do that (free for OSS) - please take a look and consider signing up for our newsletter to keep in touch.

@darrachequesne
Copy link
Member

Closed by socketio/socket.io-parser#83

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.

3 participants