-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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 single-character string filling #9837
Changes from all commits
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 |
---|---|---|
|
@@ -606,6 +606,9 @@ void Fill(const FunctionCallbackInfo<Value>& args) { | |
|
||
} else if (enc == UCS2) { | ||
node::TwoByteValue str(env->isolate(), args[1]); | ||
if (IsBigEndian()) | ||
SwapBytes16(reinterpret_cast<char*>(&str[0]), str_length); | ||
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. From your comment sounds like just this needs to be removed right? 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. Sorry, I should have made this clearer, but this is already the working version; i.e. this line was missing and should already have been there afaict |
||
|
||
memcpy(ts_obj_data + start, *str, MIN(str_length, fill_length)); | ||
|
||
} else { | ||
|
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.
For backwards compatibility do we still need to check for
'binary'
, or is that no longer supported? If this is back ported then it'll probably need to be checked there.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.
@trevnorris I switched the blocks around here so that this is after
normalizeEncoding
, so there’s no need to worry about alternate namesThere 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.
cool. thanks.