Skip to content

Accept an empty data channel message - #1698

Merged
ladvoc merged 2 commits into
mainfrom
ladvoc/webrtc-sys-empty-data-channel-message
Nov 18, 2026
Merged

ladvoc merged 2 commits into
mainfrom
ladvoc/webrtc-sys-empty-data-channel-message

Conversation

@ladvoc

@ladvoc ladvoc commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Original PR #1630 by @sutyum:

libwebrtc delivers a zero-length data channel message with a null pointer. DataChannelObserverWrapper::on_message passes it to std::slice::from_raw_parts, which requires a non-null pointer even for len == 0. So a debug build aborts the whole process (unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null) as soon as any peer sends an empty message. Release builds keep going, though it is still UB.

This treats len == 0 as an empty slice and only calls from_raw_parts otherwise.

We hit this on a robot station that receives teleoperation commands over Cloudflare Realtime data channels: a single empty packet from a remote peer took the debug station down.

@CLAassistant

CLAassistant commented Nov 18, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown
Contributor

Changeset ✓

This PR includes a changeset covering all affected packages:

Package Bump
libwebrtc patch
livekit patch
livekit-capture patch
livekit-ffi patch
webrtc-sys patch

@ladvoc
ladvoc force-pushed the ladvoc/webrtc-sys-empty-data-channel-message branch from f33ceb9 to b889a99 Compare November 18, 2026 05:54
@ladvoc
ladvoc marked this pull request as ready for review November 18, 2026 05:58

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@ladvoc
ladvoc merged commit 53effd0 into main Nov 18, 2026
44 of 70 checks passed
@ladvoc
ladvoc deleted the ladvoc/webrtc-sys-empty-data-channel-message branch November 18, 2026 11:31
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.

3 participants