pgsql: Refine memory allocation in ICU conversions

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Refine memory allocation in ICU conversions
Date: 2017-07-02 03:09:06
Message-ID: E1dRVFy-0000QY-6m@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Refine memory allocation in ICU conversions

The simple calculations done to estimate the size of the output buffers
for ucnv_fromUChars() and ucnv_toUChars() could overflow int32_t for
large strings. To avoid that, go the long way and run the function
first without an output buffer to get the correct output buffer size
requirement.

Branch
------
master

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

Modified Files
--------------
src/backend/utils/adt/pg_locale.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2017-07-02 04:12:44 pgsql: doc: Document that logical replication supports synchronous repl
Previous Message Tom Lane 2017-07-01 18:25:17 pgsql: Clean up misuse and nonuse of poll_query_until().