agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix truncation rules for base64 encoding
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix truncation rules for base64 encoding
@ 2026-07-17 13:44 Daniel Gustafsson <dgustafsson@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Daniel Gustafsson @ 2026-07-17 13:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix truncation rules for base64 encoding

Commit e1d917182 added support for base64url encoding, a base64 variant
intended to be safe for usage in URLs and filenames.  The padding rules
for base64url and base64 differ in that base64url require no extra '='
padding, but the commit unintentionally relaxed this requirement for
base64 as well.  Fix by making sure that the truncation logic check
for the encoding and add a test to make sure.

Backpatch down to v19 where support for base64url was introduced.

Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: David E. Wheeler <david@justatheory.com>
Discussion: https://postgr.es/m/3258FC72-F5E1-40B9-B5D7-64478CAF7728@yesql.se
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1f414035135cca34b606d4c0d3db0eb57045e00b

Modified Files
--------------
src/backend/utils/adt/encode.c        | 4 ++--
src/test/regress/expected/strings.out | 4 ++++
src/test/regress/sql/strings.sql      | 3 +++
3 files changed, 9 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix truncation rules for base64 encoding
@ 2026-07-17 13:46 Daniel Gustafsson <dgustafsson@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Daniel Gustafsson @ 2026-07-17 13:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix truncation rules for base64 encoding

Commit e1d917182 added support for base64url encoding, a base64 variant
intended to be safe for usage in URLs and filenames.  The padding rules
for base64url and base64 differ in that base64url require no extra '='
padding, but the commit unintentionally relaxed this requirement for
base64 as well.  Fix by making sure that the truncation logic check
for the encoding and add a test to make sure.

Backpatch down to v19 where support for base64url was introduced.

Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: David E. Wheeler <david@justatheory.com>
Discussion: https://postgr.es/m/3258FC72-F5E1-40B9-B5D7-64478CAF7728@yesql.se
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5f57f58179bf48805558ac0494851e93fe0eca76

Modified Files
--------------
src/backend/utils/adt/encode.c        | 4 ++--
src/test/regress/expected/strings.out | 4 ++++
src/test/regress/sql/strings.sql      | 3 +++
3 files changed, 9 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-07-17 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-07-17 13:44 pgsql: Fix truncation rules for base64 encoding Daniel Gustafsson <dgustafsson@postgresql.org>
2026-07-17 13:46 pgsql: Fix truncation rules for base64 encoding Daniel Gustafsson <dgustafsson@postgresql.org>

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