| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e397527 commit e2df1f8
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,11 +27,11 @@ const reportedDiagnosticEvent = { | |||
| 27 | 27 | const chunks = await toArray(serializer([diagnosticEvent])); | |
| 28 | 28 | const defaultSerializer = new DefaultSerializer(); | |
| 29 | 29 | defaultSerializer.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])]); | ||
| 35 | 35 | // Expected stdout for oversizedLengthHeader: first byte is emitted via | |
| 36 | 36 | // String.fromCharCode (byte-by-byte fallback in #drainRawBuffer), remaining | |
| 37 | 37 | // bytes go through the nonSerialized UTF-8 decode path in #processRawBuffer. | |
@@ -103,10 +103,10 @@ describe('v8 deserializer', common.mustCall(() => { | |||
| 103 | 103 | ||
| 104 | 104 | it('should not hang when buffer starts with v8Header followed by oversized length', async () => { | |
| 105 | 105 | // 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. | ||
| 110 | 110 | const reported = await collectReported([oversizedLengthHeader]); | |
| 111 | 111 | assert.partialDeepStrictEqual( | |
| 112 | 112 | reported, | |
@@ -132,14 +132,14 @@ describe('v8 deserializer', common.mustCall(() => { | |||
| 132 | 132 | }); | |
| 133 | 133 | ||
| 134 | 134 | 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. | ||
| 136 | 136 | const reported = await collectReported([headerOnly]); | |
| 137 | 137 | assert(reported.every((event) => event.type === 'test:stdout')); | |
| 138 | 138 | assert.strictEqual(collectStdout(reported), headerOnly.toString('latin1')); | |
| 139 | 139 | }); | |
| 140 | 140 | ||
| 141 | 141 | 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 | ||
| 143 | 143 | // legitimate serialized message. The parser must skip the corrupt | |
| 144 | 144 | // bytes and still deserialize the real message. | |
| 145 | 145 | const reported = await collectReported([ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -184,7 +184,7 @@ const hostObject = new (internalBinding('js_stream').JSStream)(); | |||
| 184 | 184 | Consider opening an issue as a heads up at https://github.com/nodejs/node/issues/new | |
| 185 | 185 | `; | |
| 186 | 186 | ||
| 187 | - const desStr = 'ff0f6f2203666f6f5e007b01'; | ||
| 187 | + const desStr = 'ff106f2203666f6f5e007b01'; | ||
| 188 | 188 | ||
| 189 | 189 | const desBuf = Buffer.from(desStr, 'hex'); | |
| 190 | 190 | const des = new v8.DefaultDeserializer(desBuf); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments