forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9e41114
committed
Fix obscure segfault condition in PL/Python
In PLy_output(), when the elog() call in the TRY branch throws an exception(this can happen when a statement timeout kicks in, for example), thePyErr_SetString() call in the CATCH branch can cause a segfault, because thePy_XDECREF(so) call before it releases memory that is still used by the svvariable that PyErr_SetString() uses as argument, because sv points intomemory owned by so.Backpatched back to 8.0, where this code was introduced.I also threw in a couple of volatile declarations for variables that are usedbefore and after the TRY. I don't think they caused the crash that Iobserved, but they could become issues.1 parent7d535eb commit9e41114
1 file changed
+7
-4
lines changedLines changed: 7 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 |
| - | |
| 4 | + | |
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
| |||
3076 | 3076 |
| |
3077 | 3077 |
| |
3078 | 3078 |
| |
3079 |
| - | |
| 3079 | + | |
3080 | 3080 |
| |
3081 |
| - | |
| 3081 | + | |
3082 | 3082 |
| |
3083 | 3083 |
| |
3084 | 3084 |
| |
| |||
3097 | 3097 |
| |
3098 | 3098 |
| |
3099 | 3099 |
| |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
3100 | 3104 |
| |
3101 | 3105 |
| |
3102 | 3106 |
| |
3103 | 3107 |
| |
3104 | 3108 |
| |
3105 | 3109 |
| |
3106 | 3110 |
| |
3107 |
| - | |
3108 | 3111 |
| |
3109 | 3112 |
| |
3110 | 3113 |
| |
|
0 commit comments
Comments
(0)