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-rc4267444430@github.com> (raw)
In-Reply-To: <gh-pgjdbc-pgjdbc-4332@github.com>
References: <gh-pgjdbc-pgjdbc-4332@github.com>
(on pgjdbc/src/test/java/org/postgresql/util/internal/LogMessageUtilsTest.java:74)
No test covers a value that exactly fills the room left (`appendBounded(new StringBuilder("pre:"), "value", 9)` returns `true` and gives `pre:value`), room shorter than `TRUNCATION_SUFFIX` (`"pre:"` with a 26-character value and limit 10 gives `pre:...(tr`), or no room at all (limit 4 leaves `pre:` unchanged and returns `false`). `BindLog.format` reaches these branches when the limit is almost used up. Please add a case for each, asserting the return value and the exact buffer.