Skip to content

fix(dialog): range-check table_delta indexes before narrowing (0.18.1)#155

Closed
facontidavide wants to merge 1 commit into
mainfrom
fix/table-delta-decode-bounds
Closed

fix(dialog): range-check table_delta indexes before narrowing (0.18.1)#155
facontidavide wants to merge 1 commit into
mainfrom
fix/table-delta-decode-bounds

Conversation

@facontidavide

Copy link
Copy Markdown
Contributor

Summary

Codex review of the batch-table-delta feature (#152) found that WidgetDataView::tableDelta() validates ops with is_number_integer() but then narrows with an unchecked get<int>(): an oversized index such as 4294967296 silently wraps to 0 and targets a valid-looking row instead of rejecting — corrupting the wrong row on the host.

  • Row/column indexes are now range-checked against int (via get<std::int64_t>()) before narrowing; any out-of-range value rejects the whole delta, matching the documented strict-decode contract.
  • New test TableDeltaOversizedIndexRejectsWholeDelta covers remove_rows, update row, and update col.
  • dialog-plugin-guide.md: the delta contract paragraph now states the host-side rule explicitly — unresolvable ops reject the delta whole with the seq unconsumed, and a full rows resync resets the host's seq gate (paired host change: PJ4 PR).
  • 0.18.1 PATCH (header-only, no ABI change): CHANGELOG entry + all three version sources bumped.
  • conanfile.py: removed the version-history comment block that crept back in — CHANGELOG.md is the only ledger (per feat(sdk): typed table sort keys in the dialog protocol (0.18.0) #149).

Test plan

  • widget_data_view_test (new + existing decode tests) green.
  • Full PJ4 superbuild against this branch: 269/269 tests pass, including new host-side regression tests for the paired PJ4 change.

🤖 Generated with Claude Code

is_number_integer() accepts the full 64-bit range, but the decoder narrowed
with an unchecked get<int>(), so an oversized index (e.g. 2^32) silently
wrapped into a valid-looking row instead of rejecting. Indexes are now
range-checked against int before narrowing; any out-of-range value rejects
the whole delta, matching the documented strict-decode contract.

Also documents the host-side whole-delta rejection and seq-gate reset
contract in dialog-plugin-guide.md, and removes the version-history comment
block that had crept back into conanfile.py (CHANGELOG.md is the only
ledger).

Co-Authored-By: Claude Fable 5 <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