forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita868931
committed
Fix insufficiently-paranoid GB18030 encoding verifier.
The previous coding effectively only verified that the second byte of amultibyte character was in the expected range; moreover, it wasn't carefulto make sure that the second byte even exists in the buffer before touchingit. The latter seems unlikely to cause any real problems in the field(in particular, it could never be a problem with null-terminated input),but it's still a bug.Since GB18030 is not a supported backend encoding, the only thing we'dreally be doing with GB18030 text is converting it to UTF8 in LocalToUtf,which would fail anyway on any invalid character for lack of a match inits lookup table. So the only user-visible consequence of this changeshould be that you'll get "invalid byte sequence for encoding" rather than"character has no equivalent" for malformed GB18030 input. However,impending changes to the GB18030 conversion code will require these tighterup-front checks to avoid producing bogus results.1 parentaff27e3 commita868931
1 file changed
+29
-23
lines changedLines changed: 29 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1070 | 1070 |
| |
1071 | 1071 |
| |
1072 | 1072 |
| |
1073 |
| - | |
1074 |
| - | |
1075 |
| - | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
1076 | 1076 |
| |
1077 | 1077 |
| |
1078 | 1078 |
| |
1079 | 1079 |
| |
1080 | 1080 |
| |
1081 | 1081 |
| |
1082 | 1082 |
| |
| 1083 | + | |
| 1084 | + | |
1083 | 1085 |
| |
1084 |
| - | |
1085 |
| - | |
1086 |
| - | |
1087 |
| - | |
1088 |
| - | |
1089 |
| - | |
1090 |
| - | |
1091 |
| - | |
| 1086 | + | |
1092 | 1087 |
| |
1093 | 1088 |
| |
1094 | 1089 |
| |
| |||
1403 | 1398 |
| |
1404 | 1399 |
| |
1405 | 1400 |
| |
1406 |
| - | |
1407 |
| - | |
1408 |
| - | |
1409 |
| - | |
1410 |
| - | |
1411 |
| - | |
1412 |
| - | |
| 1401 | + | |
1413 | 1402 |
| |
1414 |
| - | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
1415 | 1406 |
| |
1416 |
| - | |
1417 |
| - | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
1418 | 1414 |
| |
1419 |
| - | |
1420 |
| - | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
1421 | 1427 |
| |
1422 | 1428 |
| |
1423 | 1429 |
| |
|
0 commit comments
Comments
(0)