Skip to content

Commit

Permalink
child_process: add suggestion from @bnoordhuis
Browse files Browse the repository at this point in the history
  • Loading branch information
CaramelFur committed Jun 15, 2022
1 parent 24da8ae commit e2247c8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/internal/child_process/serialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ const advanced = {
while (messageBufferHead.length >= 4) {
// We call `readUInt32BE` manually here, because this is faster than first converting
// it to a buffer and using `readUInt32BE` on that.
const fullMessageSize = ReflectApply(readUInt32BE, messageBufferHead, [0]) + 4;
const fullMessageSize = (
messageBufferHead[0] << 24 |
messageBufferHead[1] << 16 |
messageBufferHead[2] << 8 |
messageBufferHead[3]
) + 4;

if (channel[kMessageBufferSize] < fullMessageSize) break;

Expand Down

0 comments on commit e2247c8

Please sign in to comment.