pgsql: Fix convert_case(), introduced in 5c40364dd6.

From: Jeff Davis <jdavis(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix convert_case(), introduced in 5c40364dd6.
Date: 2024-03-24 23:40:22
Message-ID: E1roXRt-005UTF-P0@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2024-03-25 00:07:24 pgsql: reindexdb: Add the index-level REINDEX with multiple jobs
Previous Message Nathan Bossart 2024-03-24 20:28:57 pgsql: doc: Clarify requirements for SET ROLE.