Skip to content

Commit 2bae61e

Browse files
fix: infinite loop on unexpected response from server function (#1898) (#1899)
1 parent f4052b2 commit 2bae61e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.changeset/tasty-hounds-poke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/start": patch
3+
---
4+
5+
fix infinite loop on unexpected response from server function (issue #1898)

packages/start/src/runtime/server-runtime.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ class SerovalChunkReader {
5858
// deserialize the data
5959
const head = new TextDecoder().decode(this.buffer.subarray(1, 11));
6060
const bytes = Number.parseInt(head, 16); // ;0x00000000;
61+
if (Number.isNaN(bytes)) {
62+
throw new Error(`Malformed server function stream header: ${head}`);
63+
}
64+
6165
// Check if the buffer has enough bytes to be parsed
6266
while (bytes > this.buffer.length - 12) {
6367
// If it's not enough, and the reader is done

0 commit comments

Comments
 (0)