forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd4a63f8
committed
Reduce an unnecessary O(N^3) loop in lexer.
The lexer's handling of operators contained an O(N^3) hazard whendealing with long strings of + or - characters; it seems hard toprevent this case from being O(N^2), but the additional N multiplierwas not needed.Backpatch all the way since this has been there since 7.x, and itpresents at least a mild hazard in that trying to do Bind, PREPARE orEXPLAIN on a hostile query could take excessive time (withouthonouring cancels or timeouts) even if the query was never executed.1 parent5ca0077 commitd4a63f8
File tree
3 files changed
+61
-22
lines changed- src
- backend/parser
- fe_utils
- interfaces/ecpg/preproc
3 files changed
+61
-22
lines changedLines changed: 20 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
885 | 885 |
| |
886 | 886 |
| |
887 | 887 |
| |
888 |
| - | |
889 |
| - | |
890 |
| - | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
891 | 891 |
| |
892 | 892 |
| |
893 | 893 |
| |
894 | 894 |
| |
895 | 895 |
| |
896 |
| - | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
897 | 901 |
| |
898 | 902 |
| |
899 |
| - | |
900 |
| - | |
901 |
| - | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
902 | 915 |
| |
903 | 916 |
| |
904 | 917 |
| |
|
Lines changed: 20 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
817 | 817 |
| |
818 | 818 |
| |
819 | 819 |
| |
820 |
| - | |
821 |
| - | |
822 |
| - | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
823 | 823 |
| |
824 | 824 |
| |
825 | 825 |
| |
826 | 826 |
| |
827 | 827 |
| |
828 |
| - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
829 | 833 |
| |
830 | 834 |
| |
831 |
| - | |
832 |
| - | |
833 |
| - | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
834 | 847 |
| |
835 | 848 |
| |
836 | 849 |
| |
|
Lines changed: 21 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
690 | 690 |
| |
691 | 691 |
| |
692 | 692 |
| |
693 |
| - | |
694 |
| - | |
695 |
| - | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
696 | 696 |
| |
697 | 697 |
| |
698 | 698 |
| |
699 |
| - | |
| 699 | + | |
700 | 700 |
| |
701 |
| - | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
702 | 706 |
| |
703 | 707 |
| |
704 |
| - | |
705 |
| - | |
706 |
| - | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
707 | 720 |
| |
708 | 721 |
| |
709 | 722 |
| |
|
0 commit comments
Comments
(0)