[Libreoffice-commits] core.git: android/source sal/osl

Christian Lohmaier (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 19 17:17:13 UTC 2019


 android/source/build.gradle |    7 +++++++
 sal/osl/unx/file.cxx        |    9 ++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 93ee955c5359e283e2fe88e45b4c02a60525ed11
Author:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
AuthorDate: Mon Nov 18 17:08:00 2019 +0100
Commit:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
CommitDate: Tue Nov 19 18:16:18 2019 +0100

    tdf#128101 android: fix documents with manual page break
    
    code reads a .ui file to show a menu to edit/delete that pagebreak. That
    file was not packaged in the Android viewer and causes an exception that
    is not handled and ultimately results in a crash.
    
    Change-Id: Ie73d886daf9202ba12e1b5a241bc7b6d184ae770
    Reviewed-on: https://gerrit.libreoffice.org/83104
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/android/source/build.gradle b/android/source/build.gradle
index 5bf49406648e..5ca9a02a4973 100644
--- a/android/source/build.gradle
+++ b/android/source/build.gradle
@@ -149,6 +149,13 @@ task copyUnpackAssets(type: Copy) {
                 )
         }
     }
+    // documents with manual page break trigger attempt to read the ui file
+    // would trigger a css::container::NoSuchElementException with osl_File_E_NOENT
+    // if not present and since it is not caught would crash the app...
+    into('config') {
+        from "${liboInstdir}/share/config"
+        include '**/pagebreakmenu.ui'
+    }
 }
 
 task copyAssets(type: Copy) {
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 96a9cfecf2b1..b6a0acaae2c4 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -830,8 +830,15 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI
     {
         void* address;
         size_t size;
+        // some requests are /assets//foo...
+        size_t offset = sizeof("/assets/")-1;
+        if (cpFilePath[offset] == '/') {
+            __android_log_print(ANDROID_LOG_DEBUG,"libo:sal/osl/unx/file", "double-slash in path: %s", cpFilePath);
+            offset++;
+        }
         AAssetManager* mgr = lo_get_native_assetmgr();
-        AAsset* asset = AAssetManager_open(mgr, cpFilePath + sizeof("/assets/")-1, AASSET_MODE_BUFFER);
+        AAsset* asset = AAssetManager_open(mgr, cpFilePath + offset, AASSET_MODE_BUFFER);
+
         if (!asset)
         {
             address = NULL;


More information about the Libreoffice-commits mailing list