pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix convert_case(), introduced in 5c40364dd6.
Date: Sun, 24 Mar 2024 23:40:22 +0000
Message-ID: <E1roXRt-005UTF-P0@gemulon.postgresql.org> (raw)

Fix convert_case(), introduced in 5c40364dd6.

Check source length before checking for NUL terminator to avoid
reading one byte past the string end. Also fix unreachable bug when
caller does not expect NUL-terminated result.

Add unit test coverage of convert_case() in case_test.c, which makes
it easier to reproduce the valgrind failure.

Discussion: https://postgr.es/m/7a9fd36d-7a38-4dc2-e676-fc939491a95a@gmail.com
Reported-by: Alexander Lakhin

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/503c0ad976f5e4ada2d1b47ae05aa7133351b645

Modified Files
--------------
src/common/unicode/case_test.c | 101 +++++++++++++++++++++++++++++++++++++++--
src/common/unicode_case.c      |   6 +--
2 files changed, 101 insertions(+), 6 deletions(-)



view thread (2+ messages)

Message-ID: <E1roXRt-005UTF-P0@gemulon.postgresql.org>
Permalink:  ../E1roXRt-005UTF-P0@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1roXRt-005UTF-P0@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: jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix convert_case(), introduced in 5c40364dd6.
  In-Reply-To: <E1roXRt-005UTF-P0@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