[MDEV-20778] UBSAN: call to function free_rpl_filter() through pointer to incorrect function type Created: 2019-10-09 Updated: 2019-10-30 Resolved: 2019-10-14 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Replication, Server |
| Affects Version/s: | 10.1, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.2.28, 10.3.19, 10.4.9 |
| Type: | Bug | Priority: | Major |
| Reporter: | Eugene Kosov (Inactive) | Assignee: | Eugene Kosov (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Full message looks like this:
|
| Comments |
| Comment by Eugene Kosov (Inactive) [ 2019-10-09 ] | ||||||||||
|
Please, review. This patch is needed to eventually make UBSAN available for InnoDB testing. | ||||||||||
| Comment by Oleksandr Byelkin [ 2019-10-10 ] | ||||||||||
|
When I agree with uchar* I have no idea why other types touched. | ||||||||||
| Comment by Eugene Kosov (Inactive) [ 2019-10-10 ] | ||||||||||
|
Thanks for you review, sanja! In general, you can't cast any pointer type to any pointer type because it violates language object model. Rules are more or less the same for both C and C++. | ||||||||||
| Comment by Oleksandr Byelkin [ 2019-10-11 ] | ||||||||||
|
free_key_cache & free_rpl_filter need only object of certain type and you remove this in definition of the function, I do not see sens in this change. | ||||||||||
| Comment by Eugene Kosov (Inactive) [ 2019-10-11 ] | ||||||||||
|
If I don't change free_rpl_filter() type I see this:
No surprises here: types of function pointer are different. It I 'fix' that with a cast of a function pointer like this:
I see this:
And this is exactly what I'm fixing in this patch: consequences of incorrect function type cast. | ||||||||||
| Comment by Oleksandr Byelkin [ 2019-10-14 ] | ||||||||||
|
So maybe one should use cast during call or change code to use correct pointers, is it possible? | ||||||||||
| Comment by Oleksandr Byelkin [ 2019-10-14 ] | ||||||||||
|
OK to push |