Uh oh!
There was an error while loading. Please reload this page.
buffer: validate list elements in Buffer.concat - #4951
Conversation
There was a problem hiding this comment.
I chose instanceof for consistency (Buffer.isBuffer is never used in this file).
There was a problem hiding this comment.
I was suggesting that because, if we change how we detect Buffers (which will be implemented in isBuffer) later on, then we don't have to change this line.
cjihrig
commented
Jan 29, 2016
LGTM with one comment. |
thefourtheye
commented
Jan 29, 2016
LGTM with cjihrig's comment |
targos
commented
Jan 29, 2016
targos
commented
Jan 29, 2016
Marking |
cjihrig
commented
Jan 29, 2016
I'm not sure I would classify this as |
targos
commented
Jan 29, 2016
I agree with you. Then it would be a candidate for LTS ? |
thefourtheye
commented
Jan 29, 2016
Overall, This looks to me as just an error message change. Does this qualify for backporting? @jasnell@thealphanerd |
cjihrig
commented
Jan 29, 2016
The existing code was already checking for an array, and throwing this same error. It was a bug on our part that we didn't do adequate checking. |
r-52
commented
Jan 30, 2016
LGTM |
Without this change, if any of the elements in the list to be concatenated is not a Buffer instance, the method fails with "buf.copy is not a function". Make an isBuffer check before using the copy method so that we can throw with a better message. Fixes: nodejs#4949 PR-URL: nodejs#4951 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
rvagg
commented
Feb 8, 2016
@nodejs/lts this commit adds a new error string |
Without this change, if any of the elements in the list to be concatenated is not a Buffer instance, the method fails with "buf.copy is not a function". Make an isBuffer check before using the copy method so that we can throw with a better message. Fixes: #4949 PR-URL: #4951 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
trevnorris
commented
Feb 9, 2016
@rvagg in that case shouldn't it just be changed in master as well? seems strange to only change it on cherry-pick. |
rvagg
commented
Feb 9, 2016
@trevnorris no because master has a change that unifies all error messages, giving them consistent formatting. So what's in this is correct and nice and consistent with the rest of the codebase but that's not true of v5.x and v4.x where we need to be internally consistent with this particular file and this particular function. |
rvagg
commented
Feb 9, 2016
#3374 thar it is, I think there may be more work ontop of that as well |
rvagg
commented
Feb 11, 2016
Removed |
targos
commented
Feb 12, 2016
Should we label it as |
rvagg
commented
Feb 15, 2016
sure, done, but tbh I'm not sure if that's even used, @thealphanerd can you clarify how we should be using |
MylesBorins
commented
Feb 15, 2016
@rvagg we definitely use lts-watch is applied when a PR needs to be reviewed dont-land is added when we know a commit will not be backported. dont-land is particularly useful when doing audits of master to make sure we didn't miss anything |
Without this change, if any of the elements in the list to be concatenated is not a Buffer instance, the method fails with "buf.copy is not a function". Make an isBuffer check before using the copy method so that we can throw with a better message. Fixes: nodejs#4949 PR-URL: nodejs#4951 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
buffer: validate list elements in Buffer.concat
Without this change, if any of the elements in the list to be concatenated
is not a Buffer instance, the method fails with "buf.copy is not a function".
Make an instanceof check before using the copy method so that we can throw
a with a better message.
Fixes: #4949