Repository navigation
Cherry pick #115708 to 25.8: Bound the size of the PostgreSQL startup message - #116000
Merged
Merged
Conversation
Bounding the declared size of the startup message is not enough on its own: `StartupMessage::deserialize` reads parameter names and values with `readNullTerminated`, which keeps appending to the string until the next `'\0'` arrives, regardless of the declared size. A client could therefore declare a tiny startup packet and then stream an arbitrarily long unterminated parameter, consuming memory before authentication. Wrap the connection in a `LimitReadBuffer` bounded by the declared payload size in `MessageTransport::receiveWithPayloadSize`, so the parser cannot read past the end of the message. The remaining-size check inside `StartupMessage::deserialize` stays as a consistency check within that bounded payload. Add a socket-level test that declares a small startup message and then streams bytes without a terminator. Address review: #115708
…sage-size Bound the size of the PostgreSQL startup message
…ypick/25.8/115708 # Conflicts: # src/Server/PostgreSQLHandler.cpp
alexey-milovidov
added a commit
that referenced
this pull request
Aug 28, 2026
`reapplied_by` walked one level out from the direct remover, so it found the revert that first put a change back and stopped there. With `#109946` ← `#114911` ← `#114912` ← `#115500` ← `#116000` — out, back, out, back, all inside one cycle — it reported only `#114912`, which the recorded bullet already carried from the first restoration. The re-apply check was therefore satisfied by the stale line and `#116000` was lost for good: a revert of a revert has no bullet of its own, so the link on the entry is its only trace in the release. `revert_chain` now walks the whole chain above the entry, and the uncancelled reverts of that chain are the ones that ship, so they are the ones that belong on the bullet. `removed_by` is the complement — the cancelled ones — which also makes the prompt name both removals of a repeated cycle instead of the first. The three-pull-request case is unchanged: one remover, one re-applier. The prompt asks for the links of every re-applier, noting that some may already be on the recorded line from an earlier restoration. `test_a_longer_chain_records_every_reapply` walks the five-pull-request timeline and asserts `removed_by == ['114911', '115500']`, `reapplied_by == ['114912', '116000']`, that replaying the recorded line is rejected for missing `#116000`, and that appending it passes. It fails with the one-level walk.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original pull-request #115708
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job