vcl/source/gdi/CommonSalLayout.cxx |    5 +++++
 vcl/source/outdev/font.cxx         |    3 +++
 2 files changed, 8 insertions(+)

New commits:
commit 3d7ca1bd1c4cc9d468ae214ecb497f71bad340f8
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Thu Apr 28 15:24:07 2022 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Fri Apr 29 06:57:24 2022 +0200

    don't try to find glyph font fallback for null character
    
    Change-Id: I53000b4da6e208774d5e8c23948474e2e9a1cf3e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133561
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 0007e3f355d1..e2b9e79bfba4 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -165,6 +165,11 @@ void 
GenericSalLayout::SetNeedFallback(vcl::text::ImplLayoutArgs& rArgs, sal_Int
     if (nCharPos < 0 || mbFuzzing)
         return;
 
+    // Do not try to find fallback for null character, as that is pointless 
and it would break
+    // searching for it (the broken ofz34898-1.doc document triggers this).
+    if (rArgs.mrStr[nCharPos] == '\0')
+        return;
+
     using namespace ::com::sun::star;
 
     if (!mxBreak.is())
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index ba487b0198c3..de3a0726c72c 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1208,7 +1208,10 @@ std::unique_ptr<SalLayout> 
OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
     bool bRTL = false;
     OUStringBuffer aMissingCodeBuf(512);
     while (rLayoutArgs.GetNextPos( &nCharPos, &bRTL))
+    {
+        assert(rLayoutArgs.mrStr[nCharPos] != '\0');
         aMissingCodeBuf.append(rLayoutArgs.mrStr[nCharPos]);
+    }
     rLayoutArgs.ResetPos();
     OUString aMissingCodes = aMissingCodeBuf.makeStringAndClear();
 

Reply via email to