summaryrefslogtreecommitdiffstats
path: root/sal/osl/unx/system.cxx
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:44:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:44:47 +0000
commit91fe6b97952aa6f7cef58327fd085a17db38ad95 (patch)
tree7a4412295bfb80e15a4936fe67d4bd7b96458ce8 /sal/osl/unx/system.cxx
parentReleasing progress-linux version 4:24.2.1-4~progress7.99u1. (diff)
downloadlibreoffice-91fe6b97952aa6f7cef58327fd085a17db38ad95.tar.xz
libreoffice-91fe6b97952aa6f7cef58327fd085a17db38ad95.zip
Merging upstream version 4:24.2.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--sal/osl/unx/system.cxx26
1 files changed, 14 insertions, 12 deletions
diff --git a/sal/osl/unx/system.cxx b/sal/osl/unx/system.cxx
index f19bd70531..eba4fe01c6 100644
--- a/sal/osl/unx/system.cxx
+++ b/sal/osl/unx/system.cxx
@@ -48,11 +48,6 @@ int macxp_resolveAlias(char *path, int buflen)
(void) buflen;
return 0;
#else
- CFStringRef cfpath;
- CFURLRef cfurl;
- CFErrorRef cferror;
- CFDataRef cfbookmark;
-
// Don't even try anything for files inside the app bundle. Just a
// waste of time.
@@ -74,12 +69,19 @@ int macxp_resolveAlias(char *path, int buflen)
if ( unprocessedPath )
*unprocessedPath = '\0';
- cfpath = CFStringCreateWithCString( nullptr, path, kCFStringEncodingUTF8 );
- cfurl = CFURLCreateWithFileSystemPath( nullptr, cfpath, kCFURLPOSIXPathStyle, false );
- CFRelease( cfpath );
- cferror = nullptr;
- cfbookmark = CFURLCreateBookmarkDataFromFile( nullptr, cfurl, &cferror );
- CFRelease( cfurl );
+ // tdf#155710 handle conversion failures due to non-UTF8 strings
+ // Windows and Linux paths can be passed as parameters to this function
+ // and those paths may not always be UTF8 encoded like macOS paths.
+ CFStringRef cfpath = CFStringCreateWithCString( nullptr, path, kCFStringEncodingUTF8 );
+ CFErrorRef cferror = nullptr;
+ CFDataRef cfbookmark = nullptr;
+ if (cfpath)
+ {
+ CFURLRef cfurl = CFURLCreateWithFileSystemPath( nullptr, cfpath, kCFURLPOSIXPathStyle, false );
+ CFRelease( cfpath );
+ cfbookmark = CFURLCreateBookmarkDataFromFile( nullptr, cfurl, &cferror );
+ CFRelease( cfurl );
+ }
if ( cfbookmark == nullptr )
{
@@ -91,7 +93,7 @@ int macxp_resolveAlias(char *path, int buflen)
else
{
Boolean isStale;
- cfurl = CFURLCreateByResolvingBookmarkData( nullptr, cfbookmark, kCFBookmarkResolutionWithoutUIMask,
+ CFURLRef cfurl = CFURLCreateByResolvingBookmarkData( nullptr, cfbookmark, kCFBookmarkResolutionWithoutUIMask,
nullptr, nullptr, &isStale, &cferror );
CFRelease( cfbookmark );
if ( cfurl == nullptr )