https://bugs.winehq.org/show_bug.cgi?id=53531
Bug ID: 53531 Summary: FTDI Vinculum II IDE gets "Out of memory" error on startup Product: Wine Version: 7.14 Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P2 Component: msxml3 Assignee: wine-bugs@winehq.org Reporter: damjan.jov@gmail.com Distribution: ---
While investigating bug 38350, users noticed how after upgrading Wine (some time ago), the error message on startup changed from "OLE error 8002006" to "Out of memory".
Using WINEDEBUG='+relay,+msxml' and looking at the last msxml call prior to the "Out of memory" string appearing, I found it comes from domelem_get_item() line 1837:
---snip--- 1834 curr = xmlNewNsProp(NULL, xmlns, ns->prefix, ns->href); 1835 if (!curr) { 1836 xmlFreeNs(xmlns); 1837 return E_OUTOFMEMORY; 1838 } ---snip---
and xmlNewNsProp() fails because ns->prefix is NULL.
However that code wasn't always there. Looking through the Git history and testing past Wine versions, I isolated it to this commit, before which it got further during startup:
---snip--- commit 4460cb3377a045de8cde82d846e8e0d3592d5252 (HEAD) Author: Daniel Lehman dlehman25@gmail.com Date: Mon Oct 15 21:14:34 2018 -0700
msxml3: Treat namespaces as floating attributes.
Signed-off-by: Daniel Lehman dlehman25@gmail.com Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org ---snip---
https://bugs.winehq.org/show_bug.cgi?id=53531
Damjan Jovanovic damjan.jov@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, regression Blocks| |38350 Regression SHA1| |4460cb3377a045de8cde82d846e | |8e0d3592d5252 URL| |http://www.ftdichip.com/Fir | |mware/vnc2toolchain/Vinculu | |m%20II%20Installer%20V2.0.2 | |-SP2.exe
https://bugs.winehq.org/show_bug.cgi?id=53531
--- Comment #1 from Rafał Mużyło galtgendo@o2.pl --- By libxml2 docs, NULL prefix is valid and means 'default namespace'.
So, this code is incorrect, but proper fix is unclear.
https://bugs.winehq.org/show_bug.cgi?id=53531
--- Comment #2 from Damjan Jovanovic damjan.jov@gmail.com --- The problematic XML document, is just this single node:
<IDEConfig xmlns="http:///ide/MySchema.xsd%5C%22/%3E
libxml2 converts namespace definition attributes ("xmlns:XYZ") into "struct xmlNs" and makes them available as a linked list on their parent struct xmlNode, pointed to by struct xmlNode's "nsDef" field. These "struct xmlNs" instances are not xmlNode subtypes, but just a simple struct with little more than "prefix" and "href" fields, and the linked list pointers. All other (non-namespace-definition) attributes go into struct xmlNode's "properties" and are (closer to) full-blown xmlNode subtypes with their many fields.
MSXML on the other hand, treats namespace definition attributes as ordinary attributes, and provides the full IXMLDOMAttribute interface for them.
Before the commit causing the "regression", Wine just provided the non-namespace-definition attributes in IXMLDOMNode::get_attributes(). In the IXMLDOMNamedNodeMap returned by that method, IXMLDOMNamedNodeMap::get_length() returned 0 for the XML tag in question here.
The application was happy with this and proceeded further.
The commit then changed this behaviour, by starting to returning the union of struct xmlNode's "properties" and "nsDef" lists from IXMLDOMNode::get_attributes(). IXMLDOMNamedNodeMap::get_length() then became 1, and IXMLDOMNamedNodeMap::get_item(0) failed as originally described.
Now converting xmlns:XYZ="href" attributes to IXMLDOMAttributes works well, but the default namespace attribute xmlns="href" fails and returns the error. Why?
Once the namespace for the given index to IXMLDOMNamedNodeMap::get_item() is found (variable "ns"), the code in domelem_get_item() first creates a new namespace with prefix "xmlns" and href "http://www.w3.org/2000/xmlns/", then creates an attribute node using that new namespace, and the matched namespace's prefix and href (so as to produce xmlns:prefix=href). When the matched namespace is the default namespace, prefix is NULL, and xmlNewNsProp() does not allow a NULL name argument (prefix parameter).
---snip--- xmlns = xmlNewNs(NULL, BAD_CAST "http://www.w3.org/2000/xmlns/", BAD_CAST "xmlns"); if (!xmlns) return E_OUTOFMEMORY;
curr = xmlNewNsProp(NULL, xmlns, ns->prefix, ns->href); if (!curr) { xmlFreeNs(xmlns); return E_OUTOFMEMORY; } ---snip---
One way to fix, is when ns->prefix is NULL, create "curr" using xmlNewProp(NULL, "xmlns", ns->href) instead of xmlNewNsProp(). I am not sure whether that will behave correctly in other calls though.
https://bugs.winehq.org/show_bug.cgi?id=53531
daniel dlehman25@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dlehman25@gmail.com
--- Comment #3 from daniel dlehman25@gmail.com --- https://gitlab.winehq.org/wine/wine/-/merge_requests/895
https://bugs.winehq.org/show_bug.cgi?id=53531
temp82@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |temp82@luukku.com
--- Comment #4 from temp82@luukku.com --- (In reply to daniel from comment #3)
wasnt this fixed in git? wine 8.03 still complains out of memory.
https://bugs.winehq.org/show_bug.cgi?id=53531
--- Comment #5 from daniel dlehman25@gmail.com ---
wasnt this fixed in git? wine 8.03 still complains out of memory.
hasn't been merged yet. i put it here so someone can apply it locally for now
https://bugs.winehq.org/show_bug.cgi?id=53531
--- Comment #6 from temp82@luukku.com --- still an issue wine 8.6.
https://bugs.winehq.org/show_bug.cgi?id=53531
--- Comment #7 from daniel dlehman25@gmail.com --- merged https://gitlab.winehq.org/wine/wine/-/merge_requests/4631
now i get the "OLE Error 80020006" from https://bugs.winehq.org/show_bug.cgi?id=38350
https://bugs.winehq.org/show_bug.cgi?id=53531
--- Comment #8 from temp82@luukku.com --- (In reply to daniel from comment #7)
merged https://gitlab.winehq.org/wine/wine/-/merge_requests/4631
now i get the "OLE Error 80020006" from https://bugs.winehq.org/show_bug.cgi?id=38350
I get exactly the same result with wine 9.1.
https://bugs.winehq.org/show_bug.cgi?id=53531
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de
--- Comment #9 from Fabian Maurer dark.shadow4@web.de --- You mean this bug is fixed? Or did I misunderstand?
https://bugs.winehq.org/show_bug.cgi?id=53531
--- Comment #10 from daniel dlehman25@gmail.com ---
You mean this bug is fixed?
yeah. now the problem is back to the original bug (38350)
https://bugs.winehq.org/show_bug.cgi?id=53531
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Fixed by SHA1| |57a391b85bed02322b16f996b52 | |ab92a778d1775 Resolution|--- |FIXED
--- Comment #11 from Fabian Maurer dark.shadow4@web.de --- Marking fixed by https://gitlab.winehq.org/wine/wine/-/commit/57a391b85bed02322b16f996b52ab92...
https://bugs.winehq.org/show_bug.cgi?id=53531
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #12 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 9.15.