Stop asserting that Unicode normalization consumes its whole input - Mailing list pgsql-hackers

From Tristan Partin
Subject Stop asserting that Unicode normalization consumes its whole input
Date
Msg-id DLILPXVKR2GW.1KP2DGOPCP7P2@partin.io
Whole thread
Responses Re: Stop asserting that Unicode normalization consumes its whole input
List pgsql-hackers
normalize() and IS NORMALIZED determine how many code points their input
holds with pg_mbstrlen_with_len(). They then decode exactly that many
code points, and assert afterward that this consumed the entire datum.
That invariant does not hold because pg_mbstrlen_with_len() stops at the
first of "limit" or a NUL.

Postgres doesn't allow text types to contain NUL, so reaching this
requires work, but src/test/regress/sql/encoding.sql already constructs
such values to pin down how the string functions behave on them. It just
never passed them to normalize() or IS NORMALIZED, which is why this
went unnoticed.

--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)

Attachment

pgsql-hackers by date:

Previous
From: shihao zhong
Date:
Subject: Re: [patch] Cache invalidation for I/O Workers
Next
From: Hannu Krosing
Date:
Subject: Re: ANSI SQL proposal: SELECT DISTINCT ON (... ORDER BY ...) and UNION DISTINCT ON (... ORDER BY ...)