@@ -27,11 +27,11 @@ const reportedDiagnosticEvent = {
2727const chunks = await toArray ( serializer ( [ diagnosticEvent ] ) ) ;
2828const defaultSerializer = new DefaultSerializer ( ) ;
2929defaultSerializer . writeHeader ( ) ;
30- const headerLength = defaultSerializer . releaseBuffer ( ) . length ;
31- const headerOnly = Buffer . from ( [ 0xff , 0x0f ] ) ;
32- const oversizedLengthHeader = Buffer . from ( [ 0xff , 0x0f , 0x7f , 0xff , 0xff , 0xff ] ) ;
33- const unsignedOversizedLengthHeader = Buffer . from ( [ 0xff , 0x0f , 0x80 , 0x00 , 0x00 , 0x00 ] ) ;
34- const truncatedLengthHeader = Buffer . from ( [ 0xff , 0x0f , 0x00 , 0x01 , 0x00 , 0x00 ] ) ;
30+ const headerOnly = Buffer . from ( defaultSerializer . releaseBuffer ( ) ) ;
31+ const headerLength = headerOnly . length ;
32+ const oversizedLengthHeader = Buffer . concat ( [ headerOnly , Buffer . from ( [ 0x7f , 0xff , 0xff , 0xff ] ) ] ) ;
33+ const unsignedOversizedLengthHeader = Buffer . concat ( [ headerOnly , Buffer . from ( [ 0x80 , 0x00 , 0x00 , 0x00 ] ) ] ) ;
34+ const truncatedLengthHeader = Buffer . concat ( [ headerOnly , Buffer . from ( [ 0x00 , 0x01 , 0x00 , 0x00 ] ) ] ) ;
3535// Expected stdout for oversizedLengthHeader: first byte is emitted via
3636// String.fromCharCode (byte-by-byte fallback in #drainRawBuffer), remaining
3737// bytes go through the nonSerialized UTF-8 decode path in #processRawBuffer.
@@ -103,10 +103,10 @@ describe('v8 deserializer', common.mustCall(() => {
103103
104104 it ( 'should not hang when buffer starts with v8Header followed by oversized length' , async ( ) => {
105105 // Regression test for https://github.com/nodejs/node/issues/62693
106- // FF 0F is the v8 serializer header; the next 4 bytes are read as a
107- // big-endian message size. 0x7FFFFFFF far exceeds any actual buffer
108- // size, causing #processRawBuffer to make no progress and
109- // #drainRawBuffer to loop forever without the no-progress guard.
106+ // The v8 serializer header is followed by 4 bytes read as a big-endian
107+ // message size. 0x7FFFFFFF far exceeds any actual buffer size, causing
108+ // #processRawBuffer to make no progress and #drainRawBuffer to loop
109+ // forever without the no-progress guard.
110110 const reported = await collectReported ( [ oversizedLengthHeader ] ) ;
111111 assert . partialDeepStrictEqual (
112112 reported ,
@@ -132,14 +132,14 @@ describe('v8 deserializer', common.mustCall(() => {
132132 } ) ;
133133
134134 it ( 'should flush v8Header-only bytes as stdout when stream ends' , async ( ) => {
135- // Just the two-byte v8 header with no size field at all.
135+ // Just the v8 header bytes with no size field at all.
136136 const reported = await collectReported ( [ headerOnly ] ) ;
137137 assert ( reported . every ( ( event ) => event . type === 'test:stdout' ) ) ;
138138 assert . strictEqual ( collectStdout ( reported ) , headerOnly . toString ( 'latin1' ) ) ;
139139 } ) ;
140140
141141 it ( 'should resync and parse valid messages after false v8 header' , async ( ) => {
142- // A false v8 header (FF 0F + oversized length) followed by a
142+ // A false v8 header (header bytes + oversized length) followed by a
143143 // legitimate serialized message. The parser must skip the corrupt
144144 // bytes and still deserialize the real message.
145145 const reported = await collectReported ( [
0 commit comments