3.8 KiB
Owned book response validation before retirement — 2026-11-27
The owned-book branch of source0x244 erased its pending request before parsing the text and checking end-of-packet. A malformed response with a matching text ID therefore threw after consuming the request. A later complete response could no longer be associated with that owned book. This is a demonstrated state-loss defect, separate from parent0x239 mail-result work.
The fix validates the bounded NUL-terminated text and complete framing before removing the pending entry. It does not create a retry, reorder requests, synthesize text, or change ownership policy. A complete response for an item no longer owned is still consumed without output, as before. The mailbox branch is unchanged.
Source/native contract
Source /mnt/Games/@project/build/source-server-main-20261124/source/src/game/Handlers/MailHandler.cpp:977–992, HandleItemTextQuery, sends SMSG_ITEM_TEXT_QUERY_RESPONSE containing the requested uint32 text ID followed by the source string. In this task that response answers an owned-item book request; the source handler name does not make it a mail-result0x239 change.
Maintained native /mnt/Games/@project/servers/trinity-forever/src/server/game/Server/Packets/QueryPackets.cpp:512–530 writes QueryItemTextResponse as Valid bit/flush, item GUID, then13-bit text length/flush and text bytes. Existing gateway native0x4b0010 output and8191-byte text limit are retained. No new opcode or original70334 reader claim is introduced.
The current pending-book association is the gateway’s correlation between source text ID and the actual owned native item. Rejecting a partial response must not commit the dequeue side effect. This follows the existing validated-response lifecycle, not an invented admission guard.
Integrated regression
Added18 assertions inside the existing native_misc_request_test.cpp book section, which already constructs an owned inventory item, sends/records its query, validates exact native GUID/text/length, checks two same-ID requests separately, and consumes replies for a removed item without output.
New cases preserve a snapshot of pending identity/order while rejecting every truncation from the matching four-byte ID through the unterminated text, a trailing byte, and an8192-byte text exceeding the native13-bit limit. After those failures the existing valid response must still emit the exact item/text and retire once. An additional malformed first response with two pending queries must preserve both entries; subsequent valid responses retain existing FIFO behavior.
Before the fix the first matching-ID-only truncation throws but fails the pending-preservation assertion (before log); execution stops there, so no complete before-failure count is claimed. No separate duplicate run of accepted controls was performed: those assertions run as part of the changed fixture.
Only the changed world_translation unit is rebuilt and linked directly into the changed fixture; remaining runtime functions use the pinned75d0ba65 shared native/protocol snapshot with6dc6e75a headers. Input hashes identify that snapshot. Compilation uses C++20 with warnings-as-errors and the integration’s paired gameobject/item-render profile defines. This is a focused integration check, not a release-library build or full gate.
After correction: 270 checks PASS, zero failures, including18 new assertions (after log, receipt).
Scope and boundaries
Only native/world_translation.cpp’s owned-book0x244 branch, tests/native_misc_request_test.cpp, and this evidence directory change. No ops/CMake, mailbox behavior, mail0x239, duel0x2b7, queues39/42, codec or client changes. Live native book display remains outside this host result. Parent owns integration.