Closed ashamedbit closed 9 months ago
Nothing says that the pointer returned by mxmlFindElement can't be deleted - the ownership of nodes is managed outside of Mini-XML...
This is more an issue of a current constant being overridden by a new one - not something that will normally occur (you'd get a compile error) but something that we need to track somehow. Without the delete you'll end up with duplicate nodes, so this fix isn't correct.
Given that you have the poc188.txt in the other PR, I'll close this one out and track any changes over there.
Hello, I am a new contributor to the repository :). I was going through the issues and was able to create a patch for issue #16 . Additionally, I also found the following Heap-Use-After-Free (testcase attached below poc188.txt)
The double free or the HUAF occurs because
temp
(anmxml_node
) returned frommxmlFindElement
is freed within functionsort_node
. But the definition ofmxmlFindElement
shows that the returned node is not a node that is allocated withmxmlNewElement
and therefore should not be freed. This leads to both heap-use-after-free and double free later on in the code.After removing the free statement I was able to verify that both heap use-after-free and double-free were gone.
Let me know if the patch is helpful :)