Commit f703d01
authored
* assignor: fix rd_list destroy callback type mismatch (#5195)
Fix the UBSan warning:
runtime error: call to function rd_kafka_assignor_destroy through pointer
to incorrect function type 'void (*)(void *)'
by changing rd_kafka_assignor_destroy to take a void * argument, as
expected by rd_list_init() destroy callbacks, and casting internally
to rd_kafka_assignor_t *. Removed explicit cast from rd_list_init argument rd_kafka_assignor_destroy as it is exactly the type as expected by rd_list_init.
* assignor: fix rd_list destroy callback type mismatch (#5195)
Fix the UBSan warning:
runtime error: call to function rd_kafka_assignor_destroy through pointer
to incorrect function type 'void (*)(void *)'
by adding two callback functions which are of required type and which call destroy callbacks internally. rd_list_init uses these new callbacks.
1. rd_kafka_assignor_topic_free(void *ptr) - calls rd_kafka_assignor_topic_destroy after typecasting ptr
2. rd_kafka_assignor_free(void *ptr) - calls rd_kafka_assignor_destroy after typecasting ptr
These new callbacks are used in rd_list_init calls which are of expected types. These wrappers avoid the function type mismatch reported by UBSan while keeping the original destroy helpers typed to their concrete pointer types.
This fixes the UBSan warning about calling the destroy callbacks through pointers with the wrong function type and removes the explicit casts at the rd_list_init() call sites.
Tests:
- UBSan enabled locally to reproduce and verify the issue
- make quick on trivup (./interactive_broker_version.py 3.6.0)
1 parent 59b2f66 commit f703d01
1 file changed
+16
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
243 | 250 | | |
244 | 251 | | |
245 | 252 | | |
| |||
267 | 274 | | |
268 | 275 | | |
269 | 276 | | |
270 | | - | |
| 277 | + | |
271 | 278 | | |
272 | 279 | | |
273 | 280 | | |
| |||
457 | 464 | | |
458 | 465 | | |
459 | 466 | | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
460 | 474 | | |
461 | 475 | | |
462 | 476 | | |
| |||
580 | 594 | | |
581 | 595 | | |
582 | 596 | | |
583 | | - | |
| 597 | + | |
584 | 598 | | |
585 | 599 | | |
586 | 600 | | |
| |||
0 commit comments