forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit79f2b5d
committed
Fix valgrind's "unaddressable bytes" whining about BRIN code.
brin_form_tuple calculated an exact tuple size, then palloc'd andfilled just that much. Later, brin_doinsert or brin_doupdate wouldMAXALIGN the tuple size and tell PageAddItem that that was the sizeof the tuple to insert. If the original tuple size wasn't a multipleof MAXALIGN, the net result would be that PageAddItem would memcpya few more bytes than the palloc request had been for.AFAICS, this is totally harmless in the real world: the error is aread overrun not a write overrun, and palloc would certainly haverounded the request up to a MAXALIGN multiple internally, so there'sno chance of the memcpy fetching off the end of memory. Valgrind,however, is picky to the byte level not the MAXALIGN level.Fix it by pushing the MAXALIGN step back to brin_form_tuple. (The otherpossible source of tuples in this code, brin_form_placeholder_tuple,was already producing a MAXALIGN'd result.)In passing, be a bit more paranoid about internal allocations inbrin_form_tuple.1 parent3503003 commit79f2b5d
2 files changed
+13
-6
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
58 |
| - | |
| 58 | + | |
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
| |||
273 | 273 |
| |
274 | 274 |
| |
275 | 275 |
| |
276 |
| - | |
| 276 | + | |
277 | 277 |
| |
278 | 278 |
| |
279 | 279 |
| |
|
Lines changed: 11 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
103 | 103 |
| |
104 | 104 |
| |
105 | 105 |
| |
106 |
| - | |
107 |
| - | |
108 |
| - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
109 | 110 |
| |
110 | 111 |
| |
111 | 112 |
| |
| |||
144 | 145 |
| |
145 | 146 |
| |
146 | 147 |
| |
| 148 | + | |
| 149 | + | |
| 150 | + | |
147 | 151 |
| |
148 | 152 |
| |
149 | 153 |
| |
| |||
160 | 164 |
| |
161 | 165 |
| |
162 | 166 |
| |
163 |
| - | |
164 | 167 |
| |
165 | 168 |
| |
| 169 | + | |
| 170 | + | |
166 | 171 |
| |
167 | 172 |
| |
168 | 173 |
| |
| 174 | + | |
| 175 | + | |
169 | 176 |
| |
170 | 177 |
| |
171 | 178 |
| |
|
0 commit comments
Comments
(0)