Clear up strxfrm() in UTF-8 with locale on Windows

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-patches(at)postgresql(dot)org
Subject: Clear up strxfrm() in UTF-8 with locale on Windows
Date: 2007-04-09 09:22:12
Message-ID: 20070409174312.8794.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

The attached patch clears up the usage of strxfrm() on Windows. If the
server encoding is UTF-8 and the locale is not C, we should use wcsxfrm()
instead of strxfrm() because UTF-8 locale are not supported on Windows.
We've already have a special version of strcoll() for Windows, but the
usage of strxfrm() was still broken.

When we are caught up in the bug, we see the next error message.
| ERROR: invalid memory alloc request size 2147483648
If the server is wrong configured between the server encoding and the
locale, strxfrm() could be failed and return values like INT_MAX or
(size_t)-1. We've passed the result+1 straight to palloc(), so the server
tried to allocale more than 1GB of memory and gave up.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
fix_strxfrm.patch application/octet-stream 2.5 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message ITAGAKI Takahiro 2007-04-09 11:01:34 Re: autovacuum multiworkers, patch 5
Previous Message Simon Riggs 2007-04-09 06:21:57 Re: Reviewers Guide to DeferredTransactions/TransactionGuarantee