This issue is still reproducible using Oracle database version 18.104.22.168.
The OCI application is linked with OCI, XML client libraries distributed with 22.214.171.124.
Oracle 126.96.36.199 Client is installed on the Client machine and the connection is to an Oracle 188.8.131.52 instance.
Calls to XmlSaveDom() with a valid destination buffer - randomly fail with XMLERR_SAVE_OVERFLOW.
The connection is using Unicode mode. Not using Unicode mode is not an option.
There are references to Unix, Big-endian platforms in Doc ID 1331104.1, BUG:10388142
However, the issue is reproducible using Windows, Little-endian platforms as well.
Following is the workflow that fails:
1) XmlSaveDom() is first called with a NULL destination buffer - to obtain the document size.
2) Based on the doc_size returned in the 1st call, an output buffer is allocated
3) XmlSaveDom() is called again to serialize the xmlnode to the destination buffer, specifying the buffer allocated in Step 2
The 2nd call to XMLSaveDom then fails with XMLERR_SAVE_OVERFLOW (20), returning an empty output buffer and doc_size = 0 bytes.
This failure occurs randomly, i.e. the workflow enumerated above works several times before failing as described.