Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0XDU-001zNW-1N for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2026 04:00:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0XDR-00DEa7-1x for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2026 04:00:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0XDR-00DEZx-11 for pgsql-hackers@lists.postgresql.org; Thu, 12 Mar 2026 04:00:05 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0XDP-00000002F7U-1NaW for pgsql-hackers@postgresql.org; Thu, 12 Mar 2026 04:00:05 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4852f8ac7e9so5727835e9.1 for ; Wed, 11 Mar 2026 21:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773288002; x=1773892802; darn=postgresql.org; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=QxhdL23flmE6qQEYaGv7MQdw4mC8I7uKliXDbw35TI4=; b=kFJq9X05wusKhcu4hz44lvu1/VTYKIz6NwkVQVZ6k+ZFoZwYF4ZaHEDnuqtwZR8bst mIw/Mrjm/QLSgWB7YRu0V2oO69M4LPJhqhWvBXb1zZ72jhnIy8J6CGZ6ocj/n9QBD0eJ HvEFnDzchVDLyzYR3vu/MPLqzBtjlbKcdP+1CZvvDhXyOtqBjtmtxcE4nyZCiseU7lsE S4Db2M6Zpw80F9nirh4dwww74mARdLyntcawWGnXOswL5ozSoovxbeCB3sHNfrxIFG2T ROSjmUkxQfUn+YNZ1jjP+qt7wUvBW1a/ktg6Ns72UDpud5oNW+Cc3bWJhDkA3CESpASS N2DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773288002; x=1773892802; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QxhdL23flmE6qQEYaGv7MQdw4mC8I7uKliXDbw35TI4=; b=FNY/VfBPRXQGwppHXA+2IxyP1P277b0FeYah9cxo/WeXrkVfZp1Qt3P3l9wraCqqSx xkRkzvFwcOsjSQ80QGTt0tdiNSgGcWkrWrVF98GdUfGINqlg/guKV0aMSLZZThp3jE5O UN7yjDwBQrTohIm6wZNOWBqIFjnmxSVTXyYzvGnnm+KubMQDJjxRLz2TIZwIll1DqI4A BwagJ50LM043cdWMJQyNyCy72C7g6nNtoD13fiCmlHyyfgEuqkrEQQHCv8t7hnNrUxiI L+8eG1ATJM82xFENdYHs6jrZZSgZGnfQSl9Mn1B8DOEKlvVFaz0wFgsAWVtmOjEWo7Zw qXZw== X-Forwarded-Encrypted: i=1; AJvYcCXin9r0t8XYa06IhNcmEbGeRMX8yuO4vpG2htCTUBkeHsxBbqTD+JSMCV+RMHryFCVZ5uvkyCRHcaYLeH6C@postgresql.org X-Gm-Message-State: AOJu0YwF5y5bDRMUpLpVD5klXRFe+0yQF58+g0WhD8mHEmyAOyzpwy9M nrq/NOkyN8WbnSM1bbYpV/xmc5vX7uX2Z0JritjRaFGq8PiFplmjn4BRtKTvYZbO X-Gm-Gg: ATEYQzyCDZsneY1onYs4H3243xMXmyUrx5RPxWj5zd7dbt3wwu2XjDQKABJEuwqtxBU bj2u/GkYOf6IXawflLPaKbuMIjKQuLTKjtuzkBe4t4qYoT8N6JMU67kdF4ipWpxhtXboAT2H6Xi uoSHif3M8oADzpo+4PIClMSOrSzZ+6ZpzILVP4JtykrH2osw8+ZPnWi2sr3owjaAlwKF7JQNCcS yxu5AJxjVuGLiq/sNMc1yfGWwUW87fv7zlgh0BVrHWUfQwO5l1nQzMPZjbtkTZPf1O7FwkXuzbu X6DZdBwdRqxadyd5rG2kVLmnQkKyyYTocJJFCXF6GcmEuLybRH0HAA3HpzH6hvL6lfCV4ObksQr wqvZ/RisRA8KFgDy6wO1iEWCqVUVy16RCNIoaMW834czX+h/CJppNs6y2rr2hoWdOIbhYvkJ1lS ngrK1YuMMNqX6qPhM9fhuX3mrt X-Received: by 2002:a05:600c:8b45:b0:485:4006:960c with SMTP id 5b1f17b1804b1-4854b12cf1emr68295895e9.16.1773288002139; Wed, 11 Mar 2026 21:00:02 -0700 (PDT) Received: from [192.168.0.50] ([89.149.93.164]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4854a18ddedsm89202435e9.0.2026.03.11.21.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Mar 2026 21:00:01 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------v41p09y6G8ik1dggt9Lojtup" Message-ID: <96d80a47-f17f-42fa-82b1-2908efbd6541@gmail.com> Date: Thu, 12 Mar 2026 06:00:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Speed up ICU case conversion by using ucasemap_utf8To*() To: Jeff Davis , Andreas Karlsson , zengman , pgsql-hackers References: <167986ff-afcf-4542-94c6-61ee8474e138@proxel.se> <72c7c2b5848da44caddfe0f20f6c7ebc7c0c6e60.camel@j-davis.com> <4cfde442-25dd-495f-8d76-a23502ce17b8@proxel.se> <744b9998-4463-4be5-b60e-a960eeb43202@proxel.se> <5a010b27-8ed9-4739-86fe-1562b07ba564@proxel.se> Content-Language: en-US From: Alexander Lakhin In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------v41p09y6G8ik1dggt9Lojtup Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hello Jeff, 07.01.2026 00:10, Jeff Davis wrote: > Committed, thank you! I've discovered that starting from c4ff35f10, the following query: CREATE COLLATION c (provider = icu, locale = 'icu_something'); makes asan detect (maybe dubious, but still..) stack-buffer-overflow: ==21963==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffd386d4e63 at pc 0x650cd7972a76 bp 0x7ffd386d4e00 sp 0x7ffd386d45a8 ... Address 0x7ffd386d4e63 is located in stack of thread T0 at offset 67 in frame     #0 0x650cd86962ef in foldcase_options (.../usr/local/pgsql/bin/postgres+0x12322ef) (BuildId: e441a9634858193e7358e5901e7948606ff5b1b1)   This frame has 2 object(s):     [48, 52) 'status' (line 993)     [64, 67) 'lang' (line 992) <== Memory access at offset 67 overflows this variable I use a build made with: CC=gcc-13 CPPFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address -static-libasan" ./configure --with-icu ... Could you please have a look? Best regards, Alexander --------------v41p09y6G8ik1dggt9Lojtup Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
Hello Jeff,

07.01.2026 00:10, Jeff Davis wrote:
Committed, thank you!

I've discovered that starting from c4ff35f10, the following query:
CREATE COLLATION c (provider = icu, locale = 'icu_something');

makes asan detect (maybe dubious, but still..) stack-buffer-overflow:
==21963==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffd386d4e63 at pc 0x650cd7972a76 bp 0x7ffd386d4e00 sp 0x7ffd386d45a8
...
Address 0x7ffd386d4e63 is located in stack of thread T0 at offset 67 in frame
    #0 0x650cd86962ef in foldcase_options (.../usr/local/pgsql/bin/postgres+0x12322ef) (BuildId: e441a9634858193e7358e5901e7948606ff5b1b1)

  This frame has 2 object(s):
    [48, 52) 'status' (line 993)
    [64, 67) 'lang' (line 992) <== Memory access at offset 67 overflows this variable

I use a build made with:
CC=gcc-13 CPPFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address -static-libasan" ./configure --with-icu ...

Could you please have a look?

Best regards,
Alexander
--------------v41p09y6G8ik1dggt9Lojtup--