forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita3b8d91
committed
Fix theoretical bug in tuplesort
This fixes a theoretical bug in tuplesort.c which, if a bounded sort wasused in combination with a byval Datum sort (tuplesort_begin_datum), whenswitching the sort to a bounded heap in make_bounded_heap(), we'd callfree_sort_tuple(). The problem was that when sorting Datums of a byvaltype, the tuple is NULL and free_sort_tuple() would free the memory for itregardless of that. This would result in a crash.Here we fix that simply by adding a check to see if the tuple is NULLbefore trying to disassociate and free any memory belonging to it.The reason this bug is only theoretical is that nowhere in the currentcode base do we do tuplesort_set_bound() when performing a Datum sort.However, let's backpatch a fix for this as if any extension uses the codein this way then it's likely to cause problems.Author: Ronan DunklauDiscussion:https://postgr.es/m/CAApHDvpdoqNC5FjDb3KUTSMs5dg6f+XxH4Bg_dVcLi8UYAG3EQ@mail.gmail.comBackpatch-through: 9.6, oldest supported version1 parente75da4f commita3b8d91
1 file changed
+5
-2
lines changedLines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4773 | 4773 |
| |
4774 | 4774 |
| |
4775 | 4775 |
| |
4776 |
| - | |
4777 |
| - | |
| 4776 | + | |
| 4777 | + | |
| 4778 | + | |
| 4779 | + | |
| 4780 | + | |
4778 | 4781 |
|
0 commit comments
Comments
(0)