mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
buffer: align chunks on 8-byte boundary
When slicing global pool - ensure that the underlying buffer's data ptr is 8-byte alignment to do not ruin expectations of 3rd party C++ addons. NOTE: 0.10 node.js always returned aligned pointers and io.js should do this too for compatibility. PR-URL: https://github.com/iojs/io.js/pull/1126 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Bert Belder <bertbelder@gmail.com>
This commit is contained in:
parent
d33a647b4b
commit
07c066724c
@ -157,6 +157,12 @@ function palloc(that, length) {
|
||||
var buf = sliceOnto(allocPool, that, start, end);
|
||||
poolOffset = end;
|
||||
|
||||
// Ensure aligned slices
|
||||
if (poolOffset & 0x7) {
|
||||
poolOffset |= 0x7;
|
||||
poolOffset++;
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user