Uh oh!
There was an error while loading. Please reload this page.
buffer: coerce offset to integer - #18215
Conversation
The offset was formerly coerced to a integer and this reimplements that. Fixesnodejs#18208
BridgeAR
commented
Jan 17, 2018
bnoordhuis
left a comment
There was a problem hiding this comment.
LGTM, thanks. Maybe change the commit title to buffer: coerce offset to uint32.
| Buffer.prototype.readDoubleBE = function(offset, noAssert) { | ||
| offset = offset >>> 0; |
There was a problem hiding this comment.
hmm... I'd almost prefer to make this an error rather than coerce. If someone just happens to pass in 4294967296 as the offset, they're going to get unexpected results otherwise.
There was a problem hiding this comment.
I prefer that as well but all other functions right now coerce the numbers to uint32. I will open a separate PR to change that for all functions.
The offset was formerly coerced to a integer and this reimplements that. PR-URL: nodejs#18215Fixes: nodejs#18208 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
BridgeAR
commented
Jan 24, 2018
Landed in 7a23fc0 |
ChALkeR
commented
Jan 29, 2018
@BridgeAR There seems to be still no tests for e.g. |
The offset was formerly coerced to a integer and this reimplements that. PR-URL: #18215Fixes: #18208 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
The offset was formerly coerced to a integer and this reimplements that. PR-URL: #18215Fixes: #18208 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
The offset was formerly coerced to a integer and this reimplements that. PR-URL: nodejs#18215Fixes: nodejs#18208 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
codebytere
commented
Aug 2, 2018
@BridgeAR this doesn't land cleanly on |
jasnell
commented
Aug 17, 2018
@BridgeAR ... ping ... can you open a backport PR for 8.x? |
The offset was formerly coerced to a integer and this reimplements
that.
Fixes#18208
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
buffer