Signed-off-by: Paul Gofman gofmanp@gmail.com --- The motivation under this patch is fixing the crash in Halo Online which originates from libcef.dll with Wine Staging. The crash scenario is the following.
A staging patch puts a 'Times New Roman' font replacement to <datadir>/fonts/times.ttf. This is the only relevant difference introduced by Staging. When the font file is found there, gdi32 uses wine_get_data_dir() for a directory prefix to construct font file name. Later libcef.dll works with fonts through dwrite, and somehow gets confused by a "\..\" inside the font file name which it gets with IDWriteLocalFontFileLoader_GetFilePathFromKey() from system font file enumerator object.
A minimally sufficient fix for that is to collapse the font file name in create_local_file_reference() or right in localfontfileloader_GetFilePathFromKey() in dwrite/font.c. But it probably makes sense to have the paths in registry free of spurious "\..\" as these values are also exposed to applications.
libs/wine/config.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/libs/wine/config.c b/libs/wine/config.c index 2a3314cbfd..5fbda6ca51 100644 --- a/libs/wine/config.c +++ b/libs/wine/config.c @@ -132,10 +132,23 @@ static inline void remove_trailing_slashes( char *path ) static char *build_path( const char *dir, const char *name ) { size_t len = strlen(dir); - char *ret = xmalloc( len + strlen(name) + 2 ); + char *ret; + + if (len && dir[len - 1] == '/') + --len; + + while (len && name[0] == '.' && name[1] == '.' && name[2] == '/') + { + while (--len && dir[len] != '/') + ; + + name += 3; + } + + ret = xmalloc( len + strlen(name) + 2 );
memcpy( ret, dir, len ); - if (len && ret[len-1] != '/') ret[len++] = '/'; + ret[len++] = '/'; strcpy( ret + len, name ); return ret; }