diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-01-04 17:00:06 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-01-05 20:29:55 +0100 |
commit | 545851e8afb426c92b2af5f57a18937b67f0d959 (patch) | |
tree | 051cca850925e2b1f820c6aa6b672f78102832f4 | |
parent | 08b118519da8245ca67279f2b23304ab657bd7e0 (diff) |
std::size/SAL_N_ELEMENTS also counts the null terminator
which libxml2 2.12 will fail on with error:
'Extra content at the end of the document'
Change-Id: I9d5da9fdd826cce8462ede8c510eaea7281b760f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161627
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit cbb17a548b5cc6a99b6ed7735479bb4f2bc40f26)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161642
Tested-by: René Engelhard <rene@debian.org>
Reviewed-by: René Engelhard <rene@debian.org>
-rw-r--r-- | unoxml/qa/unit/domtest.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/unoxml/qa/unit/domtest.cxx b/unoxml/qa/unit/domtest.cxx index 479ff3fea697..a97248167f60 100644 --- a/unoxml/qa/unit/domtest.cxx +++ b/unoxml/qa/unit/domtest.cxx @@ -204,9 +204,9 @@ struct BasicTest : public test::BootstrapFixture mxErrHandler.set( new ErrorHandler() ); uno::Reference<XDocumentBuilder> xDB( getMultiServiceFactory()->createInstance("com.sun.star.xml.dom.DocumentBuilder"), uno::UNO_QUERY_THROW ); mxDomBuilder.set( xDB ); - mxValidInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(validTestFile), std::size(validTestFile))) ); - mxWarningInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(warningTestFile), std::size(warningTestFile))) ); - mxErrorInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(errorTestFile), std::size(errorTestFile))) ); + mxValidInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(validTestFile), std::size(validTestFile) - 1)) ); + mxWarningInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(warningTestFile), std::size(warningTestFile) - 1)) ); + mxErrorInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(errorTestFile), std::size(errorTestFile) - 1)) ); mxDomBuilder->setErrorHandler(mxErrHandler); } @@ -288,7 +288,7 @@ struct SerializerTest : public test::BootstrapFixture mxErrHandler.set( new ErrorHandler() ); uno::Reference<XDocumentBuilder> xDB( getMultiServiceFactory()->createInstance("com.sun.star.xml.dom.DocumentBuilder"), uno::UNO_QUERY_THROW ); mxDomBuilder.set( xDB ); - mxInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(validTestFile), std::size(validTestFile))) ); + mxInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(validTestFile), std::size(validTestFile) - 1)) ); mxDomBuilder->setErrorHandler(mxErrHandler); mxHandler.set( new DocumentHandler ); mxTokHandler.set( new TokenHandler ); |