Skip to content

fix(rtmp): prevent index out of range panic in encodeFLV#2241

Open
SAY-5 wants to merge 1 commit into
AlexxIT:masterfrom
SAY-5:fix/flv-encode-bounds-2061
Open

fix(rtmp): prevent index out of range panic in encodeFLV#2241
SAY-5 wants to merge 1 commit into
AlexxIT:masterfrom
SAY-5:fix/flv-encode-bounds-2061

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 2, 2026

Closes #2061.

The compiler bounds-check hint at pkg/rtmp/flv.go:58 asserted b[15] exists, but the buffer only needs to hold 15 bytes (4 prev-tag-size + 11 header) when the payload is empty, panicking with index out of range [15] with length 15. Lower the assertion to the last actually-written single byte (b[14]); the subsequent copy(b[4+11:], payload) is a no-op for empty payloads.

The bounds check hint asserted b[15] exists, but the buffer only needs
to hold 15 bytes (4 prev-tag-size + 11 header) when the payload is
empty. Lower the assertion to b[14] so an empty payload no longer
panics. Closes AlexxIT#2061.

Signed-off-by: SAY-5 <say.apm35@gmail.com>
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.

panic: runtime error

1 participant