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

hasBin should not iterate over object prototypes #1645

Closed
brandongoode opened this issue Jun 23, 2014 · 3 comments · Fixed by socketio/socket.io-client#711
Closed

hasBin should not iterate over object prototypes #1645

brandongoode opened this issue Jun 23, 2014 · 3 comments · Fixed by socketio/socket.io-client#711

Comments

@brandongoode
Copy link

Currently the hasBin function iterates over my object's prototypes (which have circular references - i.e. it crashes). Checking hasOwnProperty can be used to fix this.

function hasBinary(data) {

  function recursiveCheckForBinary(obj) {

...

      for (var key in obj) {
        if (obj.hasOwnProperty(key)  &&
          recursiveCheckForBinary(obj[key])) {
          return true;
        }
      }

...
@kevin-roark
Copy link
Contributor

@brandongoode thank you for reporting. I should be able to get a fix out tonight!

@brandongoode
Copy link
Author

@kevin-roark - thanks for the quick response.

@kevin-roark
Copy link
Contributor

@brandongoode pull requests out now, should be in the next release 💯

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 a pull request may close this issue.

2 participants