GNOME Bugzilla – Bug 605841
xmlListSort frees list elements via deallocator
Last modified: 2021-07-05 13:20:55 UTC
Having had some trouble trying to use xmlListSort, I took a look at the implementation. It seems to work by copying the original list, clearing the original list, and then inserting each element from the copy into the original. Apart from inefficiency, this has one major bug: clearing the original list calls the user-supplied deallocator on each element, making those elements unusable in the copy. This resulted in accesses to freed memory, easily found via valgrind. Originally reported in Debian: http://bugs.debian.org/563227
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.