[Libreoffice-commits] core.git: jvmfwk/plugins

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 29 08:22:34 UTC 2019


 jvmfwk/plugins/sunmajor/pluginlib/util.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit b8106018ab997931c872219986e2e9aa88b774af
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Jul 29 09:04:52 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Jul 29 10:21:45 2019 +0200

    Avoid memcpy nonnull issue
    
    ...as started to get reported by <https://ci.libreoffice.org/job/lo_ubsan/1341/>
    
    > /jvmfwk/plugins/sunmajor/pluginlib/util.cxx:368:33: runtime error: null pointer passed as argument 2, which is declared to never be null
    /usr/include/string.h:43:28: note: nonnull attribute specified here
    >     #0 0x2b710cdb4e35 in jfw_plugin::AsynchReader::execute() /jvmfwk/plugins/sunmajor/pluginlib/util.cxx:368:13
    >     #1 0x2b70c87b8a27 in salhelper::Thread::run() /salhelper/source/thread.cxx:40:9
    >     #2 0x2b70c87bac9f in threadFunc /include/osl/thread.hxx:185:15
    >     #3 0x2b70ba8bb89d in osl_thread_start_Impl(void*) /sal/osl/unx/thread.cxx:235:9
    >     #4 0x2b70bc47fdd4 in start_thread (/lib64/libpthread.so.0+0x7dd4)
    >     #5 0x2b70bcdb4eac in clone (/lib64/libc.so.6+0xfdeac)
    
    during UITest_calc_tests6
    
    Change-Id: I6505061192a8d6b9a68d72980fd134d161e5e1a3
    Reviewed-on: https://gerrit.libreoffice.org/76516
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index d8238120b04c..f703fb4c200b 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -365,7 +365,9 @@ void AsynchReader::execute()
         {
             //Save the data we have in m_arData into a temporary array
             std::unique_ptr<sal_Char[]> arTmp( new sal_Char[m_nDataSize]);
-            memcpy(arTmp.get(), m_arData.get(), m_nDataSize);
+            if (m_nDataSize != 0) {
+                memcpy(arTmp.get(), m_arData.get(), m_nDataSize);
+            }
             //Enlarge m_arData to hold the newly read data
             m_arData.reset(new sal_Char[static_cast<size_t>(m_nDataSize + nRead)]);
             //Copy back the data that was already in m_arData


More information about the Libreoffice-commits mailing list