A compressed packet could declare an unbounded decompressed size,
nest compressed packets recursively until stack overflow, or carry a
truncated inner packet whose handler then read uninitialized
memory.
A handler exception left the packet in the queue, re-raising on
every receive until the app aborted. The connection is now dropped
cleanly with a log entry.
A declared length below the header size desynced the receive queue
and dispatched handlers on garbage, and an unbounded length could
grow the queue without limit.
Abandoning a selection after the first click leaked the helper and
kept it registered for tile clicks. The helper now tracks the active
instance, copies coordinates instead of holding tile references that
can be evicted, and the listener dispatch tolerates removal during
iteration.
Inserting an item that sorted after everything left the tail
shortcut stale, so later appends unlinked existing nodes. This
leaked screen entries, their textures, and blocked cache eviction
forever.
A zero run length or a short read at the end of the data left the
row decoder spinning forever, and runs that overshot the row width
wrote past the image buffer. The decode buffer is now freed on
errors as well.
The write path always computed legacy offsets and sizes while the
loader detected and used the High Seas layout, so any tile edit on a
High Seas tiledata.mul shifted records and corrupted the file.
The static RLE encoder read 16-bit pixels from the 32-bit working
image with a 16-bit stride, garbling every pixel and testing a green
channel bit as the visibility flag. The land encoder shifted every
diamond row to a constant or double-stride column. Both matched the
decoder on load and produced scrambled art on save. Also frees the
conversion image on the early exit paths.
Delete continued the loop with a dangling previous-node pointer after
disposing the matched entry. It now returns after the first match,
which is the behavior all callers rely on.
Flush sized the base stream from its own overridden size, which
delegates to the base stream, so appended data was truncated or the
copy failed. Flushing a reader would have wiped the file; the reader
writes through immediately and needs no flush. Write now also
propagates short writes from the base stream.
Seek accepted positions outside the queue, allowing reads before the
buffer, and negative counts reached Move with garbage sizes. Writing
to a locked stream silently dropped the lock window instead of
failing, which corrupts packet parsing.
The null and wide-string readers tested the terminator before the
bounds check, peeked one character past the window, and used a
lock-relative position against the absolute memory base. They also
advanced past a terminator that was never read, desyncing the parser
on malformed input. Reworked them to stay in bounds and to build the
result in linear time.