summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-04-28 15:24:07 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-04-29 06:57:24 +0200
commit3d7ca1bd1c4cc9d468ae214ecb497f71bad340f8 (patch)
tree30eec0a654a09e1b2f0cb74f673a90b969e873e2 /vcl
parent2e33af67e04da39116a1dc9fda96d961ae0a4bd5 (diff)
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.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx5
-rw-r--r--vcl/source/outdev/font.cxx3
2 files changed, 8 insertions, 0 deletions
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();