xmlscript/source/xml_helper/xml_byteseq.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
New commits: commit 7b4b70afba2d6bde66dd59da5950d45efb4a645b Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Aug 23 21:15:01 2019 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Aug 23 23:33:18 2019 +0200 Avoid -fsanitizeinvalid-null-argument ...as witnessed once with some `instdir/program/unopkg remove ooo2gd_3.0.0.oxt`: > xmlscript/source/xml_helper/xml_byteseq.cxx:116:13: runtime error: null pointer passed as argument 1, which is declared to never be null > /usr/include/string.h:43:28: note: nonnull attribute specified here > #0 in xmlscript::BSeqOutputStream::writeBytes(com::sun::star::uno::Sequence<signed char> const&) at xmlscript/source/xml_helper/xml_byteseq.cxx:116:5 > #1 in fileaccess::TaskManager::page(int, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::io::XOutputStream> const&) at ucb/source/ucp/file/filtask.cxx:655:32 > #2 in fileaccess::BaseContent::open(int, com::sun::star::ucb::OpenCommandArgument2 const&) at ucb/source/ucp/file/bc.cxx:911:29 > #3 in fileaccess::BaseContent::execute(com::sun::star::ucb::Command const&, int, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at ucb/source/ucp/file/bc.cxx:323:53 > #4 in non-virtual thunk to fileaccess::BaseContent::execute(com::sun::star::ucb::Command const&, int, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at ucb/source/ucp/file/bc.cxx > #5 in ucbhelper::Content_Impl::executeCommand(com::sun::star::ucb::Command const&) at ucbhelper/source/client/content.cxx:1254:19 > #6 in ucbhelper::Content::openStream(com::sun::star::uno::Reference<com::sun::star::io::XOutputStream> const&) at ucbhelper/source/client/content.cxx:816:14 > #7 in dp_misc::readFile(ucbhelper::Content&) at desktop/source/deployment/misc/dp_ucb.cxx:195:23 > #8 in dp_misc::readLine(rtl::OUString*, rtl::OUString const&, ucbhelper::Content&, unsigned short) at desktop/source/deployment/misc/dp_ucb.cxx:207:34 > #9 in dp_registry::backend::configuration::(anonymous namespace)::BackendImpl::configmgrini_verify_init(com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at desktop/source/deployment/registry/configuration/dp_configuration.cxx:371:17 [...] Change-Id: I66bef2d1bc037efa893f3ae3ad8058aa16f7cc5b Reviewed-on: https://gerrit.libreoffice.org/78042 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/xmlscript/source/xml_helper/xml_byteseq.cxx b/xmlscript/source/xml_helper/xml_byteseq.cxx index 24b7e2b6ee47..dc443a968e2d 100644 --- a/xmlscript/source/xml_helper/xml_byteseq.cxx +++ b/xmlscript/source/xml_helper/xml_byteseq.cxx @@ -113,9 +113,11 @@ void BSeqOutputStream::writeBytes( Sequence< sal_Int8 > const & rData ) { sal_Int32 nPos = _seq->size(); _seq->resize( nPos + rData.getLength() ); - memcpy( _seq->data() + nPos, - rData.getConstArray(), - rData.getLength() ); + if (rData.getLength() != 0) { + memcpy( _seq->data() + nPos, + rData.getConstArray(), + rData.getLength() ); + } } void BSeqOutputStream::flush() { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits