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 deprecated Buffer constructor usage and add safeguards #506

Merged
merged 2 commits into from Feb 21, 2019

Commits on Feb 18, 2018

  1. nodejsUtils: don't use deprecated Buffer api

    This avoids using Buffer constructor API on newer Node.js versions.
    
    To achieve that, Buffer.from presence is checked, with validating that it's
    not the same method as Uint8Array.from.
    
    Refs:
    https://nodejs.org/api/deprecations.html#deprecations_dep0005_buffer_constructor
    ChALkeR committed Feb 18, 2018
    Copy the full SHA
    28cd570 View commit details
    Browse the repository at this point in the history
  2. nodejsUtils: additional Buffer safeguards for older Node.js

    1. In allocBuffer(), ensure buffers allocated with new Buffer() are zero-filled.
       On newer Node.js versions, Buffer.alloc() zero-fills already.
    
    2. In newBufferFrom(), throw when 'data' argument is a number.
       On newer Node.js versions, Buffer.from(number)/new Buffer(number, encooding)
       throw already.
    ChALkeR committed Feb 18, 2018
    Copy the full SHA
    8461371 View commit details
    Browse the repository at this point in the history