- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit33c697e
committed
Make ts_locale.c's character-type functions cope with UTF-16.
On Windows, in UTF8 database encoding, what char2wchar() produces isUTF16 not UTF32, ie, characters above U+FFFF will be represented bysurrogate pairs. t_isdigit() and siblings did not account for thisand failed to provide a large enough result buffer. That in turnled to bogus "invalid multibyte character for locale" errors, becausecontrary to what you might think from char2wchar()'s documentation,its Windows code path doesn't cope sanely with buffer overflow.The solution for t_isdigit() and siblings is pretty clear: providea 3-wchar_t result buffer not 2.char2wchar() also needs some work to provide more consistent, and moreaccurately documented, buffer overrun behavior. But that's a bigger joband it doesn't actually have any immediate payoff, so leave it for later.Per bug #15476 from Kenji Uno, who deserves credit for identifying thecause of the problem. Back-patch to all active branches.Discussion:https://postgr.es/m/15476-4314f480acf0f114@postgresql.org1 parent1aad3a7 commit33c697e
1 file changed
+19
-8
lines changedLines changed: 19 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
26 | 37 |
| |
27 | 38 |
| |
28 | 39 |
| |
29 | 40 |
| |
30 |
| - | |
| 41 | + | |
31 | 42 |
| |
32 | 43 |
| |
33 | 44 |
| |
34 | 45 |
| |
35 | 46 |
| |
36 | 47 |
| |
37 |
| - | |
| 48 | + | |
38 | 49 |
| |
39 | 50 |
| |
40 | 51 |
| |
| |||
43 | 54 |
| |
44 | 55 |
| |
45 | 56 |
| |
46 |
| - | |
| 57 | + | |
47 | 58 |
| |
48 | 59 |
| |
49 | 60 |
| |
50 | 61 |
| |
51 | 62 |
| |
52 | 63 |
| |
53 |
| - | |
| 64 | + | |
54 | 65 |
| |
55 | 66 |
| |
56 | 67 |
| |
| |||
59 | 70 |
| |
60 | 71 |
| |
61 | 72 |
| |
62 |
| - | |
| 73 | + | |
63 | 74 |
| |
64 | 75 |
| |
65 | 76 |
| |
66 | 77 |
| |
67 | 78 |
| |
68 | 79 |
| |
69 |
| - | |
| 80 | + | |
70 | 81 |
| |
71 | 82 |
| |
72 | 83 |
| |
| |||
75 | 86 |
| |
76 | 87 |
| |
77 | 88 |
| |
78 |
| - | |
| 89 | + | |
79 | 90 |
| |
80 | 91 |
| |
81 | 92 |
| |
82 | 93 |
| |
83 | 94 |
| |
84 | 95 |
| |
85 |
| - | |
| 96 | + | |
86 | 97 |
| |
87 | 98 |
| |
88 | 99 |
| |
|
0 commit comments
Comments
(0)