BUG #17277: write past chunk when calling normalize() on an empty string

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #17277: write past chunk when calling normalize() on an empty string
Дата
Msg-id 17277-0c527a373794e802@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #17277: write past chunk when calling normalize() on an empty string  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17277
Logged by:          Matthijs van der Vleuten
Email address:      postgresql@zr40.nl
PostgreSQL version: 14.0
Operating system:   Debian sid
Description:

When calling normalize(''), that is, on an empty string, a warning is
raised: "problem in alloc set ExprContext: detected write past chunk end".

I believe this is due to an error in unicode_norm.c. In unicode_normalize(),
when recompose is true (that is, when using NFC or NFKC normalization) the
loop on line 498 will iterate once before checking count < decomp_size. When
the input is an empty string, this would cause a write outside of the memory
allocated for recomp_chars.

Reproduction:
zr40@[local]:5432 ~=# select version();
                                                     version
                                     
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 PostgreSQL 14.0 (Debian 14.0-1.pgdg+1) on x86_64-pc-linux-gnu, compiled by
gcc (Debian 10.3.0-11) 10.3.0, 64-bit
(1 row)
zr40@[local]:5432 ~=# select normalize('');
WARNING:  problem in alloc set ExprContext: detected write past chunk end in
block 0x55793d119620, chunk 0x55793d1196a8
WARNING:  problem in alloc set ExprContext: detected write past chunk end in
block 0x55793d119620, chunk 0x55793d1196a8
 normalize 
───────────
 
(1 row)


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data