-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
buffer: fix fill
with encoding in Buffer.alloc()
#9238
Changes from 1 commit
c31be42
275b17b
54c9dad
90af46a
baad1f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1060,6 +1060,17 @@ assert.throws(function() { | |
Buffer.allocUnsafe(0xFFFFFFFFF); | ||
}, RangeError); | ||
|
||
// issue GH-9226 | ||
{ | ||
const buf = Buffer.alloc(4, 'YQ==', 'base64'); | ||
const expectedBuf = new Buffer([97, 97, 97, 97]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea; I had been under the impression that |
||
assert(buf.equals(expectedBuf)); | ||
} | ||
{ | ||
const buf = Buffer.alloc(4, 'ab', 'ascii'); | ||
const expectedBuf = new Buffer([97, 98, 97, 98]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
assert(buf.equals(expectedBuf)); | ||
} | ||
|
||
// attempt to overflow buffers, similar to previous bug in array buffers | ||
assert.throws(function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be better to provide a URL instead (or at least in addition).