forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9ae2661
committed
Tighten checks for whitespace in functions that parse identifiers etc.
This patch replaces isspace() calls with scanner_isspace() in functionsthat are likely to be presented with non-ASCII input. isspace() hasthe small advantage that it will correctly recognize no-break spacein single-byte encodings (such as LATIN1); but it cannot work successfullyfor any multibyte character, and depending on platform it might returnfalse positive results for some fragments of multibyte characters. That'sdisastrous for functions that are trying to discard whitespace betweenvalid strings, as noted in bug #14662 from Justin Muise. Even treatingno-break space as whitespace is pretty questionable for the usages touchedhere, because the core scanner would think it is an identifier character.Affected functions are parse_ident(), parseNameAndArgTypes (underlyingregprocedurein() and siblings), SplitIdentifierString (used for parsingGUCs and options that are qualified names or lists of names), andSplitDirectoriesString (used for parsing GUCs that are lists ofdirectories).All the functions adjusted here are parsing SQL identifiers and similarconstructs, so it's reasonable to insist that their definition ofwhitespace match the core scanner. So we can hope that this won't causemany backwards-compatibility problems. I've left alone isspace() callsin places that aren't really expecting any non-ASCII input characters,such as float8in().Back-patch to all supported branches.Discussion:https://postgr.es/m/10129.1495302480@sss.pgh.pa.us1 parentf61bd73 commit9ae2661
3 files changed
+15
-14
lines changedLines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
770 | 770 |
| |
771 | 771 |
| |
772 | 772 |
| |
773 |
| - | |
| 773 | + | |
774 | 774 |
| |
775 | 775 |
| |
776 | 776 |
| |
| |||
858 | 858 |
| |
859 | 859 |
| |
860 | 860 |
| |
861 |
| - | |
| 861 | + | |
862 | 862 |
| |
863 | 863 |
| |
864 | 864 |
| |
865 | 865 |
| |
866 | 866 |
| |
867 | 867 |
| |
868 |
| - | |
| 868 | + | |
869 | 869 |
| |
870 | 870 |
| |
871 | 871 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| 35 | + | |
35 | 36 |
| |
36 | 37 |
| |
37 | 38 |
| |
| |||
1769 | 1770 |
| |
1770 | 1771 |
| |
1771 | 1772 |
| |
1772 |
| - | |
| 1773 | + | |
1773 | 1774 |
| |
1774 | 1775 |
| |
1775 | 1776 |
| |
| |||
1786 | 1787 |
| |
1787 | 1788 |
| |
1788 | 1789 |
| |
1789 |
| - | |
| 1790 | + | |
1790 | 1791 |
| |
1791 | 1792 |
| |
1792 | 1793 |
| |
| |||
1842 | 1843 |
| |
1843 | 1844 |
| |
1844 | 1845 |
| |
1845 |
| - | |
| 1846 | + | |
1846 | 1847 |
| |
1847 | 1848 |
| |
1848 | 1849 |
| |
|
Lines changed: 8 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3252 | 3252 |
| |
3253 | 3253 |
| |
3254 | 3254 |
| |
3255 |
| - | |
| 3255 | + | |
3256 | 3256 |
| |
3257 | 3257 |
| |
3258 | 3258 |
| |
| |||
3290 | 3290 |
| |
3291 | 3291 |
| |
3292 | 3292 |
| |
3293 |
| - | |
| 3293 | + | |
3294 | 3294 |
| |
3295 | 3295 |
| |
3296 | 3296 |
| |
| |||
3312 | 3312 |
| |
3313 | 3313 |
| |
3314 | 3314 |
| |
3315 |
| - | |
| 3315 | + | |
3316 | 3316 |
| |
3317 | 3317 |
| |
3318 | 3318 |
| |
3319 | 3319 |
| |
3320 | 3320 |
| |
3321 |
| - | |
| 3321 | + | |
3322 | 3322 |
| |
3323 | 3323 |
| |
3324 | 3324 |
| |
| |||
3377 | 3377 |
| |
3378 | 3378 |
| |
3379 | 3379 |
| |
3380 |
| - | |
| 3380 | + | |
3381 | 3381 |
| |
3382 | 3382 |
| |
3383 | 3383 |
| |
| |||
3414 | 3414 |
| |
3415 | 3415 |
| |
3416 | 3416 |
| |
3417 |
| - | |
| 3417 | + | |
3418 | 3418 |
| |
3419 | 3419 |
| |
3420 | 3420 |
| |
3421 | 3421 |
| |
3422 | 3422 |
| |
3423 | 3423 |
| |
3424 | 3424 |
| |
3425 |
| - | |
| 3425 | + | |
3426 | 3426 |
| |
3427 | 3427 |
| |
3428 | 3428 |
| |
3429 | 3429 |
| |
3430 | 3430 |
| |
3431 |
| - | |
| 3431 | + | |
3432 | 3432 |
| |
3433 | 3433 |
| |
3434 | 3434 |
| |
|
0 commit comments
Comments
(0)