Always set context node before calling XPath iterators
The xmlXPathNext* iterators rely on the XPath context node being set to the start node of the iteration. Some parts of the code base like the xsl:key functions also leave the context node in an unspecified state. Make sure that the context node is reset before invoking the XPath iterators. Also backup and restore the context node in xsltNumberFormatGetMultipleLevel for good measure. This bug could also lead to type confusion and invalid reads in connection with namespace nodes. Fixes #13. Also see the Chromium bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=930663 Thanks to Nicolas Grégoire for the report.
Showing with 31 additions and 11 deletions