Skip to content

Check stream-closed-on-reentry and drop packets with invalid sack blocks#279

Merged
jthomas43 merged 1 commit intoholepunchto:mainfrom
jthomas43:fix-reentry-and-sack-check
Mar 22, 2026
Merged

Check stream-closed-on-reentry and drop packets with invalid sack blocks#279
jthomas43 merged 1 commit intoholepunchto:mainfrom
jthomas43:fix-reentry-and-sack-check

Conversation

@jthomas43
Copy link
Copy Markdown
Contributor

Check for potential stream-closed-on-reentry after potential on_drain in on_bytes_acked() and on_read(EOF) after send_ack()

Check that incoming sack blocks have a reasonable range: pkt.ack < sack.start and sack.end < stream.seq, and drop invalid packets.

…cked and on_read(EOF) after send_ack(). check incoming sack blocks are within pkt.ack < start.start and sack.end < stream.seq
@jthomas43 jthomas43 requested a review from mafintosh March 20, 2026 23:10
assert(bytes <= stream->writes_queued_bytes);
stream->writes_queued_bytes -= bytes;

if (cancelled) return;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no need to call on drain if we're closing.


on_bytes_acked(wbuf, pkt_len, false);
if (stream->status & UDX_STREAM_DEAD) {
deref_packet(pkt);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

need to deref here since we unhook from the circular queue when processing the packet, it would be missed by the stream_close code

@jthomas43 jthomas43 merged commit 0420f62 into holepunchto:main Mar 22, 2026
3 checks passed
@jthomas43 jthomas43 deleted the fix-reentry-and-sack-check branch March 22, 2026 05:11
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