- Notifications
You must be signed in to change notification settings - Fork5
Commit7894ac5
committed
Make sure chr(int) can't create invalid UTF8 sequences.
Several years ago we changed chr(int) so that if the database encoding isUTF8, it would interpret its argument as a Unicode code point and expand itinto the appropriate multibyte sequence. However, we weren't sufficientlycareful about checking validity of the input. According to RFC3629, UTF8disallows code points above U+10FFFF (note that the predecessor standardRFC2279 was more liberal). Also, both versions of the UTF8 spec agreethat Unicode surrogate-pair codes should never appear in UTF8. Becauseour encoding validity checks follow RFC3629, our failure to enforce theserestrictions in chr() means it could be used to produce text strings thatwill be rejected when the database is dumped and reloaded. To ensureconsistency with the input functions, let's actually applypg_utf8_islegal() to the proposed output of chr().Per discussion, this seems like too much of a behavioral change toback-patch, but it's not too late to squeeze it into 9.4.1 parentaf215d8 commit7894ac5
1 file changed
+18
-7
lines changedLines changed: 18 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
932 | 932 |
| |
933 | 933 |
| |
934 | 934 |
| |
935 |
| - | |
| 935 | + | |
936 | 936 |
| |
937 |
| - | |
938 |
| - | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
939 | 943 |
| |
940 | 944 |
| |
941 | 945 |
| |
| |||
950 | 954 |
| |
951 | 955 |
| |
952 | 956 |
| |
953 |
| - | |
| 957 | + | |
954 | 958 |
| |
955 | 959 |
| |
956 | 960 |
| |
| |||
971 | 975 |
| |
972 | 976 |
| |
973 | 977 |
| |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
974 | 988 |
| |
975 |
| - | |
976 | 989 |
| |
977 | 990 |
| |
978 | 991 |
| |
| |||
981 | 994 |
| |
982 | 995 |
| |
983 | 996 |
| |
984 |
| - | |
985 | 997 |
| |
986 | 998 |
| |
987 | 999 |
| |
| |||
995 | 1007 |
| |
996 | 1008 |
| |
997 | 1009 |
| |
998 |
| - | |
999 | 1010 |
| |
1000 | 1011 |
| |
1001 | 1012 |
| |
|
0 commit comments
Comments
(0)