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

adventure-yunfei fix: wrong overwritting of not writable Unit8Array.from #148

Merged
merged 1 commit into from
Dec 2, 2016

Conversation

adventure-yunfei
Copy link
Contributor

Uint8Array defined an unwritable from property, which causes overwritting operation after changing Buffer.__proto__ fails and break script execution.

e.g. failing to assign ".from" property in Chrome:
image

When use buffer with webpack, everything after Buffer.from = ... just gone.

And e.g. failing to require buffer in node@4
image

We should move "Buffer.from" assignment forward to avoid this error.

Note that this may not be reproducible on all browser. In some browsers (or node@6) Uint8Array doesn't have 'from', or defines a writable 'from' property.

@feross
Copy link
Owner

feross commented Dec 2, 2016

What version of Chrome are you using? I've never seen this error.

@feross
Copy link
Owner

feross commented Dec 2, 2016

I suppose this can't do any harm, so why not?

@feross feross merged commit 88941ed into feross:master Dec 2, 2016
@feross
Copy link
Owner

feross commented Dec 2, 2016

Released as 5.0.2

@adventure-yunfei
Copy link
Contributor Author

@feross I've printed out chrome version (which is 50.0.2661.102), and node version (which is 4.4.4). On these platforms, Object.getOwnPropertyDescriptor(Uint8Array.__proto__, 'from') will get a non-writable descriptor.

(And I've also tested latest chrome@55.0 and node@6.9.1 which shows it's writable instead.)

@feross
Copy link
Owner

feross commented Jan 23, 2017

@adventure-yunfei Sounds good. Thanks for testing!

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