Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Jan 7, 2026

Summary

Add null check for itemHeader after parsing to prevent crashes when parseJSONFromBuffer returns null for malformed envelope data.

Problem

In processEnvelope.ts, accessing itemHeader.length without a null check causes crashes when parsing fails:

const itemHeader = parseJSONFromBuffer(readLine()) as EnvelopeItem[0];
const payloadLength = itemHeader.length;  // Crashes if itemHeader is null

Solution

Add null check matching the existing pattern used for envelope header handling (lines 42-46).

Fixes SPOTLIGHT-9W

Fixes SPOTLIGHT-9W

Add null check for itemHeader after parsing to prevent crashes when
parseJSONFromBuffer returns null for malformed envelope data. This
matches the existing pattern used for envelope header handling.
@vercel
Copy link

vercel bot commented Jan 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
spotlightjs Skipped Skipped Jan 7, 2026 6:30pm

@BYK BYK deployed to Preview January 7, 2026 16:32 — with GitHub Actions Active
Update getParsedEnvelope return type to ParsedEnvelope | null and add
null checks in callers that were missing them:
- formatters/md/errors.ts
- formatters/md/logs.ts
- messageBuffer.ts filter functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants