Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Refactor buffer constructor #1912

Closed
wants to merge 1 commit into from
Closed

Refactor buffer constructor #1912

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Oct 21, 2018

Summary

This PR replaces new Buffer with Buffer.from and removes its deprecation warning.

The behavior of new Buffer() is different depending on the type of the first argument, security and reliability issues can be inadvertently introduced into applications when argument validation or Buffer initialization is not performed.

To make the creation of Buffer instances more reliable and less error-prone, the various forms of the new Buffer() constructor have been deprecated and replaced by separate Buffer.from(), Buffer.alloc(), and Buffer.allocUnsafe() methods.

details: https://nodejs.org/api/buffer.html#buffer_buffer_from_buffer_alloc_and_buffer_allocunsafe
https://github.com/nodejs/Release#end-of-life-releases

Copy link
Contributor

@niveditc niveditc left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this + including the relevant docs in your commit message for context 👍

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

niveditc is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@ghost ghost deleted the safe-buffer branch October 22, 2018 12:06
jdecked pushed a commit to twitter-forks/draft-js that referenced this pull request Oct 9, 2019
Summary:
**Summary**

This PR replaces `new Buffer` with `Buffer.from` and removes its deprecation warning.

The behavior of new Buffer() is different depending on the type of the first argument, security and reliability issues can be inadvertently introduced into applications when argument validation or Buffer initialization is not performed.

To make the creation of Buffer instances more reliable and less error-prone, the various forms of the new Buffer() constructor have been deprecated and replaced by separate Buffer.from(), Buffer.alloc(), and Buffer.allocUnsafe() methods.

details: https://nodejs.org/api/buffer.html#buffer_buffer_from_buffer_alloc_and_buffer_allocunsafe
https://github.com/nodejs/Release#end-of-life-releases
Pull Request resolved: facebookarchive#1912

Differential Revision: D10481708

fbshipit-source-id: c4c2040133ee0bc82932de17c20fc5ca06d296c9
alicayan008 pushed a commit to alicayan008/draft-js that referenced this pull request Jul 4, 2023
Summary:
**Summary**

This PR replaces `new Buffer` with `Buffer.from` and removes its deprecation warning.

The behavior of new Buffer() is different depending on the type of the first argument, security and reliability issues can be inadvertently introduced into applications when argument validation or Buffer initialization is not performed.

To make the creation of Buffer instances more reliable and less error-prone, the various forms of the new Buffer() constructor have been deprecated and replaced by separate Buffer.from(), Buffer.alloc(), and Buffer.allocUnsafe() methods.

details: https://nodejs.org/api/buffer.html#buffer_buffer_from_buffer_alloc_and_buffer_allocunsafe
https://github.com/nodejs/Release#end-of-life-releases
Pull Request resolved: facebookarchive/draft-js#1912

Differential Revision: D10481708

fbshipit-source-id: c4c2040133ee0bc82932de17c20fc5ca06d296c9
aforismesen added a commit to aforismesen/draft-js that referenced this pull request Jul 12, 2024
Summary:
**Summary**

This PR replaces `new Buffer` with `Buffer.from` and removes its deprecation warning.

The behavior of new Buffer() is different depending on the type of the first argument, security and reliability issues can be inadvertently introduced into applications when argument validation or Buffer initialization is not performed.

To make the creation of Buffer instances more reliable and less error-prone, the various forms of the new Buffer() constructor have been deprecated and replaced by separate Buffer.from(), Buffer.alloc(), and Buffer.allocUnsafe() methods.

details: https://nodejs.org/api/buffer.html#buffer_buffer_from_buffer_alloc_and_buffer_allocunsafe
https://github.com/nodejs/Release#end-of-life-releases
Pull Request resolved: facebookarchive/draft-js#1912

Differential Revision: D10481708

fbshipit-source-id: c4c2040133ee0bc82932de17c20fc5ca06d296c9
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants