Skip to content

pygobject-object: fix memory corruption around list of closures

Mikhail Fludkov requested to merge fludkov.me/pygobject:gitlabissue158 into master

#158 (closed)

The memory corruption occurs because of the race while accessing PyGObjectData->closures list.

Protect PyGObjectData->closures by GIL in pygobject_unwatch_closure. Despite the fact that we don't call any Python API in the function. We use GIL to be sure that PyGObjectData->closures list stays intact while GC iterating the list inside pygobject_traverse. Otherwise we can segfault while trying to call 'visit' function on an object that was just freed in pygobject_unwatch_closure.

Merge request reports