Skip to content

Issue when bundling with rollup #7

Open
@schadenn

Description

@schadenn

Hi,

when using rollup to bundle, it converts modules to something like this:

var bufferEs6 = /*#__PURE__*/Object.freeze({
  __proto__: null,
  Buffer: Buffer,
  INSPECT_MAX_BYTES: INSPECT_MAX_BYTES,
  SlowBuffer: SlowBuffer,
  isBuffer: isBuffer,
  kMaxLength: _kMaxLength
});

Because the Object is explicitly set to have no prototype, this check in safer-buffer will fail (no prototype -- no hasOwnProperty()):
if (!buffer.hasOwnProperty(key)) continue

If you use the following instead, it'll work fine:
if (!Object.hasOwnProperty.call(buffer, key)) continue

Do you think this solution would be safe enough to rewrite?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions