Skip to content

fix(PIMETextService): enforce maximum buffer size limit on IPC pipe reads (#956) - #957

Merged
PCMan merged 1 commit into
masterfrom
fix/issue-956-limit-ipc-read-buffer
Oct 18, 2026
Merged

PCMan merged 1 commit into
masterfrom
fix/issue-956-limit-ipc-read-buffer

Conversation

@PCMan

@PCMan PCMan commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Fixes #956

WHAT

  • Define \static constexpr size_t kMaxIpcMessageLength = 4 * 1024 * 1024; // 4 MB\ in \PIME::Client\ (PIMEClient.h).
  • In \Client::callRpcPipe\ (PIMEClient.cpp), check \if (readBuffer_.size() >= kMaxIpcMessageLength).
  • If the buffer exceeds this limit before encountering a newline, immediately clear
    eadBuffer_\ and return \ alse, which aborts the RPC, closes the corrupted/runaway pipe connection, and resets state.

WHY

Previously, \callRpcPipe\ appended incoming pipe chunks to
eadBuffer_\ indefinitely until a newline character was reached. If a malfunctioning or unresponsive server streamed data without newlines,
eadBuffer_\ would expand without bound until triggering \std::bad_alloc\ and crashing the host process.

Generated with assistance from Antigravity (Google DeepMind).

@PCMan
PCMan force-pushed the fix/issue-956-limit-ipc-read-buffer branch from 6b5cd2b to 4ee57ea Compare October 18, 2026 08:50
…eads (#956)

WHAT:
- Add kMaxIpcMessageLength (4 MB) constant to Client class in PIMEClient.h.
- Check readBuffer_ size against kMaxIpcMessageLength during callRpcPipe() in PIMEClient.cpp.
- Clear readBuffer_ and fail the RPC if message length exceeds limit.

WHY:
- Previously, callRpcPipe buffered chunks from the named pipe until encountering a newline without any size limit.
- If a malfunctioning server streamed data without newlines, readBuffer_ would expand indefinitely and exhaust memory.

Generated with assistance from Antigravity (Google DeepMind).
@PCMan
PCMan force-pushed the fix/issue-956-limit-ipc-read-buffer branch from 4ee57ea to a04e916 Compare October 18, 2026 09:19
@PCMan PCMan self-assigned this Oct 18, 2026
@PCMan
PCMan merged commit b4465cf into master Oct 18, 2026
3 of 6 checks passed
@PCMan
PCMan deleted the fix/issue-956-limit-ipc-read-buffer branch October 18, 2026 20:36
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.

PIMETextService: enforce maximum buffer size limit on IPC pipe reads

1 participant