From: vlsi (@vlsi) <noreply+vlsi@github.com>
To: pgjdbc/pgjdbc <noreply+pgjdbc-pgjdbc@github.com>
Subject: Re: [pgjdbc/pgjdbc] PR #4332: fix: limit FINEST Bind, Parse and SimpleQuery log messages to maxLogMessageLength to avoid OOM
Date: Wed, 14 Oct 2026 06:22:27 +0000
Message-ID: <gh-pgjdbc-pgjdbc-4332-rc4267444373@github.com> (raw)
In-Reply-To: <gh-pgjdbc-pgjdbc-4332@github.com>
References: <gh-pgjdbc-pgjdbc-4332@github.com>
(on pgjdbc/src/main/java/org/postgresql/core/v3/BindLog.java)
Each value and its `>,type=…` are appended past the limit, and this `truncate` then cuts the line wherever the limit falls. With the three parameters of `budgetExhaustionDoesNotLeaveDanglingParameterPrefix`, a limit of 119 gives `…,type=VARCHAR,$2=<...(truncated)`, 117 gives `…,type=VARCHAR,$2...(truncated)`, and 143 gives `…,$3=<...(truncated)`. The same cut discards the clean ending `appendQuotedStringPrefix` builds: a value of 50 `😀` at limit 54 gives `$1=<('` followed by a lone high surrogate and `...(truncated)`, and `"ab"` followed by 100 quotes at limit 56 gives `$1=<('ab'...(truncated)`, which reads as the complete value `ab`. One character below the full length, the line loses its `)` and gets no marker: 149 gives `…,$3=<('cc')>,type=VARCHAR`. Please reserve room for `>,type=…` and the marker before appending a value, and leave out a parameter when none of its value fits, so this `truncate` never cuts.