Skip to content

fix: honor the buffer window in every send path - #245

Open
SendableMetatype wants to merge 1 commit into
devopvoid:mainfrom
SendableMetatype:fix/send-buffer-window
Open

fix: honor the buffer window in every send path#245
SendableMetatype wants to merge 1 commit into
devopvoid:mainfrom
SendableMetatype:fix/send-buffer-window

Conversation

@SendableMetatype

Copy link
Copy Markdown

RTCDataChannel.send behaves differently depending on the buffer it is handed: a heap buffer with an accessible backing array sends the entire backing array regardless of position and limit, a read only heap buffer honors the window, and a direct buffer sends the full capacity. Any caller that slices, flips, or reuses a buffer silently transmits the wrong bytes.

All paths now send exactly the bytes between position and limit, read through a duplicate so the caller's buffer state is untouched. Java only, no native changes.

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.

1 participant