pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix small overestimation of base64 encoding output length.
Date: Thu, 08 Jun 2023 15:24:41 +0000
Message-ID: <E1q7HVA-000m6h-O7@gemulon.postgresql.org> (raw)

Fix small overestimation of base64 encoding output length.

pg_base64_enc_len() and its clones overestimated the output
length by up to 2 bytes, as a result of sloppy thinking about
where to divide.  No callers require a precise estimate, so
this has no consequences worse than palloc'ing a byte or two
more than necessary.  We might as well get it right though.

This bug is very ancient, dating to commit 79d78bb26 which
added encode.c.  (The other instances were presumably copied
from there.)  Still, it doesn't quite seem worth back-patching.

Oleg Tselebrovskiy

Discussion: https://postgr.es/m/f94da55286a63022150bc266afdab754@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d98ed080bb31fd3d46281127871b7886288686d9

Modified Files
--------------
contrib/pgcrypto/pgp-armor.c   | 2 +-
src/backend/utils/adt/encode.c | 2 +-
src/common/base64.c            | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)



Message-ID: <E1q7HVA-000m6h-O7@gemulon.postgresql.org>
Permalink:  ../E1q7HVA-000m6h-O7@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1q7HVA-000m6h-O7@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix small overestimation of base64 encoding output length.
  In-Reply-To: <E1q7HVA-000m6h-O7@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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