Skip to content

Fix inverted bt-list check in session handshake parsing#46

Open
jagerman wants to merge 1 commit into
session-foundation:devfrom
jagerman:session-handshake-list-parsing
Open

Fix inverted bt-list check in session handshake parsing#46
jagerman wants to merge 1 commit into
session-foundation:devfrom
jagerman:session-handshake-list-parsing

Conversation

@jagerman

Copy link
Copy Markdown
Member

The else if branch in handle_session_handshake had an inverted condition: payload.front() != std::byte{'l'} fed non-list data into bt_list_consumer while routing actual bt-lists to the "unknown data" rejection branch. Since the bt-list form is the 1.0 backwards-compat path-switch format, this broke path switches from 1.0 peers.

Invert to == std::byte{'l'} so lists are parsed as lists and only genuinely non-dict/non-list payloads hit the rejection branch.

Also correct the misplaced/mis-worded format comment: the "2-element [0]/[1]" description belongs on the 'l' (bt-list, 1.0) branch, not the 'd' (bt-dict, new 1.1 PFS+PQ) branch.

(Fix for the issue noticed in PR #44)

The `else if` branch in handle_session_handshake had an inverted
condition: `payload.front() != std::byte{'l'}` fed non-list data into
bt_list_consumer while routing actual bt-lists to the "unknown data"
rejection branch. Since the bt-list form is the 1.0 backwards-compat
path-switch format, this broke path switches from 1.0 peers.

Invert to `== std::byte{'l'}` so lists are parsed as lists and only
genuinely non-dict/non-list payloads hit the rejection branch.

Also correct the misplaced/mis-worded format comment: the "2-element
[0]/[1]" description belongs on the 'l' (bt-list, 1.0) branch, not the
'd' (bt-dict, new 1.1 PFS+PQ) branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.

1 participant