Re: Error in calculating length of encoded base64 string

From: Gurjeet Singh <gurjeet(at)singh(dot)im>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: o(dot)tselebrovskiy(at)postgrespro(dot)ru, pgsql-hackers(at)postgresql(dot)org, Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru>
Subject: Re: Error in calculating length of encoded base64 string
Date: 2023-06-09 06:10:03
Message-ID: CABwTF4X2qMDBeoB3TX_6oVJHfA6OAwrL553a2ow_X21SRNeSfg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 8, 2023 at 7:35 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> o(dot)tselebrovskiy(at)postgrespro(dot)ru writes:
> > While working on an extension I've found an error in how length of
> > encoded base64 string is calulated;
>
> Yeah, I think you're right. It's not of huge significance, because
> it just overestimates by 1 or 2 bytes, but we might as well get
> it right. Thanks for the report and patch!

From your commit d98ed080bb

> 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.

Is it worth investing time in trying to unify these 3 occurrences of
base64 length (and possibly other relevant) code to one place? If yes,
I can volunteer for it.

The common code facility under src/common/ did not exist back when
pgcrypto was added, but since it does now, it may be worth it make
others depend on implementation in src/common/ code.

Best regards,
Gurjeet
http://Gurje.et

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-06-09 06:13:45 Re: Error in calculating length of encoded base64 string
Previous Message Michael Paquier 2023-06-09 05:58:42 Re: Introduce WAIT_EVENT_EXTENSION and WAIT_EVENT_BUFFER_PIN