summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2020-04-08 23:20:42 +0200
committerXisco Faulí <xiscofauli@libreoffice.org>2020-04-09 16:40:16 +0200
commitab0078509c352ee5d7b8ae5334d49f7c14fc26a5 (patch)
tree9c1f20d1352f0ac8e774068d0690bc67c24b96f6
parentSet Firebird creation option experimental (diff)
downloadcore-ab0078509c352ee5d7b8ae5334d49f7c14fc26a5.tar.gz
core-ab0078509c352ee5d7b8ae5334d49f7c14fc26a5.zip
tdf#129372: PPTX: error at SfxBaseModel::storeToStorage: 0x20d(row,col)
Teach starmath how to deal with surrogate pairs see https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates + comments from: https://bugs.documentfoundation.org/show_bug.cgi?id=129372#c6 Here's the culprit character: 𝜕 %uD835%uDF15 I didn't dig why these 2 (found in reduced example attached to the bugtracker) didn't need this patch 𝑋 %uD835%uDC4B 𝑢 %uD835%uDC62 Change-Id: I3bf2322a9e7f1974aa8622a91812aeb11e613ace Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91941 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr> (cherry picked from commit 11b57129b53e1e2d71a5f969e2417226b4e2ddd9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91900 Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 67af725a8623a509960a8463f7876fcd680565ad) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91902 Tested-by: Xisco Faulí <xiscofauli@libreoffice.org>
-rw-r--r--starmath/source/parse.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 76ab7b37f77b..1755c7bd5e5c 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -956,9 +956,14 @@ void SmParser::NextToken()
m_aCurToken.cMathChar = '\0';
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
- m_aCurToken.aText = m_aBufferString.copy( nRealStart, 1 );
- aRes.EndPos = nRealStart + 1;
+ // tdf#129372: we may have to deal with surrogate pairs
+ // (see https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates)
+ // in this case, we must read 2 sal_Unicode instead of 1
+ int nOffset(rtl::isSurrogate(m_aBufferString[nRealStart])? 2 : 1);
+ m_aCurToken.aText = m_aBufferString.copy( nRealStart, nOffset );
+
+ aRes.EndPos = nRealStart + nOffset;
}
if (TEND != m_aCurToken.eType)