- Notifications
You must be signed in to change notification settings - Fork5
Commitfe796ea
committed
Fix an ancient logic error in plpgsql's exec_stmt_block: it thought it could
get away with not (re)initializing a local variable if the variable is marked"isconst" and not "isnull". Unfortunately it makes this decision after havingalready freed the old value, meaning that something like for i in 1..10 loop declare c constant text := 'hi there';leads to subsequent accesses to freed memory, and hence probably crashes.(In particular, this is why Asif Ali Rehman's bug leads to crash and notjust an unexpectedly-NULL value for SQLERRM: SQLERRM is marked CONSTANTand so triggers this error.)The whole thing seems wrong on its face anyway: CONSTANT means that you can'tchange the variable inside the block, not that the initializer expression isguaranteed not to change value across successive block entries. Hence,remove the "optimization" instead of trying to fix it.1 parent7ad33ce commitfe796ea
1 file changed
+40
-32
lines changedLines changed: 40 additions & 32 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
885 | 885 |
| |
886 | 886 |
| |
887 | 887 |
| |
| 888 | + | |
888 | 889 |
| |
889 |
| - | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
890 | 896 |
| |
891 |
| - | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
892 | 906 |
| |
893 |
| - | |
894 |
| - | |
895 |
| - | |
896 |
| - | |
897 |
| - | |
898 |
| - | |
899 |
| - | |
900 |
| - | |
901 |
| - | |
902 |
| - | |
903 |
| - | |
904 |
| - | |
905 |
| - | |
906 |
| - | |
907 |
| - | |
908 |
| - | |
909 |
| - | |
910 |
| - | |
911 |
| - | |
912 |
| - | |
913 |
| - | |
914 |
| - | |
915 |
| - | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
916 | 917 |
| |
917 | 918 |
| |
918 | 919 |
| |
919 |
| - | |
920 |
| - | |
921 |
| - | |
922 |
| - | |
923 |
| - | |
924 |
| - | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
925 | 925 |
| |
926 | 926 |
| |
927 | 927 |
| |
| |||
1065 | 1065 |
| |
1066 | 1066 |
| |
1067 | 1067 |
| |
| 1068 | + | |
1068 | 1069 |
| |
| 1070 | + | |
1069 | 1071 |
| |
1070 | 1072 |
| |
1071 | 1073 |
| |
| |||
4867 | 4869 |
| |
4868 | 4870 |
| |
4869 | 4871 |
| |
| 4872 | + | |
| 4873 | + | |
| 4874 | + | |
| 4875 | + | |
| 4876 | + | |
| 4877 | + | |
4870 | 4878 |
| |
4871 | 4879 |
| |
4872 | 4880 |
| |
|
0 commit comments
Comments
(0)