Commit 5537235
committed
Bug#21823135 INVALID READ OF MEMORY FREED BY GIS_WKB_RAW_FREE
Issue:
The cmp_item_string::store_value() doesn't copy the string even if
value.is_alloced() is false, which means the string buffer referenced by 'value'
doesn't belong to 'value' but the cmp_item_string simply use this buffer
anyway, assuming the buffer will be always valid whenever it's accessed.
This is wrong in itself.
The way some GIS functions work is to return geometry blob buffer allocated
by Boost.Geometry without duplicating it, and free this buffer next time the
same function is called. Such behavior breaks above wrong assumption and
hence the memory issue.
Fix:
In cmp_item_string::store_value(), if 'value' 's referenced buffer was not
allocated by itself, duplicate its string.1 parent 24902c1 commit 5537235
File tree
4 files changed
+41
-3
lines changed- mysql-test
- r
- t
- sql-common
- sql
4 files changed
+41
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2947 | 2947 | | |
2948 | 2948 | | |
2949 | 2949 | | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2771 | 2771 | | |
2772 | 2772 | | |
2773 | 2773 | | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
188 | 191 | | |
189 | 192 | | |
190 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
191 | 211 | | |
192 | 212 | | |
193 | | - | |
194 | | - | |
| 213 | + | |
| 214 | + | |
195 | 215 | | |
196 | 216 | | |
197 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1429 | 1429 | | |
1430 | 1430 | | |
1431 | 1431 | | |
1432 | | - | |
| 1432 | + | |
1433 | 1433 | | |
1434 | 1434 | | |
1435 | 1435 | | |
| |||
0 commit comments