9 Replies Latest reply: Jan 20, 2011 5:30 AM by 655560 RSS

    Segfault when document is blank


      I've discovered a condition where dbxml will segfault when given an empty document. In this Python code the container was opened elsewhere:
          uc = mgr.createUpdateContext()
          container.putDocument(txn, 'test', '<hello></hello>', uc)
          doc = mgr.createDocument()
          qc = mgr.createQueryContext()
          qc.setVariableValue('nodes', XmlValue(doc))
          mgr.query(txn, '''let $item := doc('dbxml:test.dbxml/test') return insert nodes $nodes as last into $item''', qc)
      It does not crash if the query context variable nodes is set to a string value:
      qc.setVariableValue('nodes', XmlValue(''))
      dbxml.XmlQueryEvaluationError: XmlQueryEvaluationError Error: Cannot insert non-whitespace text node as a child of the document node, line 0, column 0