Skip to content

Commit 1c2b829

Browse files
authored
fix(node): Check buffer length when attempting to parse ANR frame (#9314)
1 parent b925322 commit 1c2b829

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/node/src/anr/websocket.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,13 @@ class WebSocketInterface extends EventEmitter {
296296
return;
297297
}
298298

299+
// There needs to be atleast two values in the buffer for us to parse
300+
// a frame from it.
301+
// See: https://github.com/getsentry/sentry-javascript/issues/9307
302+
if (buff.length <= 1) {
303+
return;
304+
}
305+
299306
const frame = parseFrame(buff);
300307

301308
if (isCompleteFrame(frame)) {

0 commit comments

Comments
 (0)