pg.ddx.io  GitHub: pgjdbc/pgjdbc (issues + PRs as email threads)  
help / color / mirror / Atom feed
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 02:52:58 +0000
Message-ID: <gh-pgjdbc-pgjdbc-4332-rc4266276825@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)

For a `bytea`, `estimateLogSize` returns the number of bytes, but `toString` renders a hex literal of `2 * n + 11` characters. With the default limit, a `bytea` of about 8 to 16 KB passes this check, its literal fills the message, and every parameter after it is dropped: `setBytes(1, new byte[10000])` followed by `setInt(2, 42)` logs no `$2`. A `String` passes the same way when quoting, escaping, and the `::type` cast make its literal longer than the room left; a value of 16000 `'` characters doubles when escaped. The placeholder also labels the byte count of a `bytea` as `~N chars`.

Please compare the length of the literal (`2 * n + 11` for a `bytea`) with the room left, show an oversized `bytea` as `<N bytes>`, and add a test with a `bytea` followed by another parameter.

view thread (58+ messages)  latest in thread

Message-ID: <gh-pgjdbc-pgjdbc-4332-rc4266276825@github.com>
Permalink:  ../gh-pgjdbc-pgjdbc-4332-rc4266276825@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox