summaryrefslogtreecommitdiff
path: root/xmlscript
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-08-23 21:15:01 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-08-23 23:33:18 +0200
commit7b4b70afba2d6bde66dd59da5950d45efb4a645b (patch)
tree6790ff2a7cd07f18611e7400285ff303f5949531 /xmlscript
parent51c663b49deea46145eef185bf4e551f2c213428 (diff)
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 <sbergman@redhat.com>
Diffstat (limited to 'xmlscript')
-rw-r--r--xmlscript/source/xml_helper/xml_byteseq.cxx8
1 files changed, 5 insertions, 3 deletions
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()
{