Menu

#204 Segfault when using callbacks

New
nobody
None
Medium
Defect
2022-04-18
2022-04-18
No

The following causes a use-after-free bug:
RPi.GPIO.add_event_detect (channel, edge, callback = RPi.GPIO.remove_event_detect)

Look at the function run_py_callbacks starting at line 586 of source/py_gpio.c In the example given above, calling the callback in line 597 causes the memory pointed to by cb to be freed. If it is overwritten before line 605 (cb = cb->next), then cb goes into hyperspace and a segfault follows.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.