libyal / libvmdk

Library and tools to access the VMware Virtual Disk (VMDK) format
GNU Lesser General Public License v3.0
163 stars 66 forks source link

pyvmdk_handle_set_parent does not reference the object pyvmdk_parent_handle #32

Closed Byzero512 closed 1 year ago

Byzero512 commented 1 year ago

pyvmdk_handle_set_parent(...) does not reference pyvmdk_parent_handle, and python gc can relese pyvmdk_parent_handle while it is parent of a vmdk handle.

in this case:

  1. pyvmdk_parent_handle->handle is set as parent of a vmdk handle in libvmdk_handle_set_parent_handle(...), but pyvmdk_parent_handle not being referenced.
  2. pyvmdk_parent_handle is released by gc, and its handle will be closed.
  3. But we can access parent vmdk with the child vmdk handle.
joachimmetz commented 1 year ago

thx for flagging I'll have a closer look when time permits

joachimmetz commented 1 year ago

Changes in https://github.com/libyal/libvmdk/commit/57661f03b0e783672eb15f4eedc003d038ec3f98