From ffa0dedf93d913536488bc1718f855e6ff48284b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sat, 5 Mar 2022 21:29:35 +0000 Subject: [PATCH] crashtesting: assert that !rtl::isAscii in xmlError message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit probably detected since: commit 089ce740f9f97f9c7b13e37a31acfc94984e9a3e Date: Thu Feb 24 17:45:18 2022 +0300 Deduplicate rtl_*String_newConcat*L or similar Change-Id: I69ac57bd5718a4da85516e2a2afa79dc2b04665e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131068 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- unoxml/source/dom/documentbuilder.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/unoxml/source/dom/documentbuilder.cxx b/unoxml/source/dom/documentbuilder.cxx index 3da15ee7d7e9..8139a4c7d8f1 100644 --- a/unoxml/source/dom/documentbuilder.cxx +++ b/unoxml/source/dom/documentbuilder.cxx @@ -138,14 +138,11 @@ namespace DOM static OUString make_error_message(xmlParserCtxtPtr ctxt) { - OUStringBuffer buf; - buf.appendAscii(ctxt->lastError.message); - buf.append("Line: "); - buf.append(static_cast(ctxt->lastError.line)); - buf.append("\nColumn: "); - buf.append(static_cast(ctxt->lastError.int2)); - OUString msg = buf.makeStringAndClear(); - return msg; + return OUString(ctxt->lastError.message, strlen(ctxt->lastError.message), RTL_TEXTENCODING_ASCII_US) + + "Line: " + + OUString::number(static_cast(ctxt->lastError.line)) + + "\nColumn: " + + OUString::number(static_cast(ctxt->lastError.int2)); } // -- callbacks and context struct for parsing from stream