forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4854ead
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 parent90b0f30 commit4854ead
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 | |
---|---|---|---|
| |||
881 | 881 |
| |
882 | 882 |
| |
883 | 883 |
| |
884 |
| - | |
885 |
| - | |
886 |
| - | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
887 | 887 |
| |
888 | 888 |
| |
889 | 889 |
| |
890 | 890 |
| |
891 | 891 |
| |
892 |
| - | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
893 | 897 |
| |
894 | 898 |
| |
895 |
| - | |
896 |
| - | |
897 |
| - | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
898 | 911 |
| |
899 | 912 |
| |
900 | 913 |
| |
|
Lines changed: 20 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
798 | 798 |
| |
799 | 799 |
| |
800 | 800 |
| |
801 |
| - | |
802 |
| - | |
803 |
| - | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
804 | 804 |
| |
805 | 805 |
| |
806 | 806 |
| |
807 | 807 |
| |
808 | 808 |
| |
809 |
| - | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
810 | 814 |
| |
811 | 815 |
| |
812 |
| - | |
813 |
| - | |
814 |
| - | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
815 | 828 |
| |
816 | 829 |
| |
817 | 830 |
| |
|
Lines changed: 21 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
687 | 687 |
| |
688 | 688 |
| |
689 | 689 |
| |
690 |
| - | |
691 |
| - | |
692 |
| - | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
693 | 693 |
| |
694 | 694 |
| |
695 | 695 |
| |
696 |
| - | |
| 696 | + | |
697 | 697 |
| |
698 |
| - | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
699 | 703 |
| |
700 | 704 |
| |
701 |
| - | |
702 |
| - | |
703 |
| - | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
704 | 717 |
| |
705 | 718 |
| |
706 | 719 |
| |
|
0 commit comments
Comments
(0)