sw/source/filter/ww8/sprmids.hxx | 1 + sw/source/filter/ww8/ww8par2.cxx | 8 -------- sw/source/filter/ww8/ww8scan.cxx | 21 +++++++-------------- 3 files changed, 8 insertions(+), 22 deletions(-)
New commits: commit 13f2e8ab8d1d8b33f3208f82d21d61250f81057d Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Mar 11 17:03:41 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Mar 12 11:47:56 2022 +0100 ofz#45488 get WW8+ calculation of sprmTDefTable length right we have the calculation correct for WW7- which is what the special L_VAR2 case is for, but for the WW8+ variant that wasn't understood. Change-Id: Ic9dde07223386df796f57dd1f33e69d16d3abf21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131395 Tested-by: Jenkins Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/filter/ww8/sprmids.hxx b/sw/source/filter/ww8/sprmids.hxx index ac1d33cf8a80..1d023c3424a9 100644 --- a/sw/source/filter/ww8/sprmids.hxx +++ b/sw/source/filter/ww8/sprmids.hxx @@ -66,6 +66,7 @@ const sal_uInt16 LN_SGprfIhdt = 0x3014; const sal_uInt16 LN_SBCustomize = 0x301e; const sal_uInt16 LN_SPropRMark = 0xd227; const sal_uInt16 LN_SFFacingCol = 0x3229; +const sal_uInt16 LN_TDefTable = 0xd608; const sal_uInt16 LN_TDefTable10 = 0xd606; const sal_uInt16 LN_THTMLProps = 0x740c; const sal_uInt16 LN_TSetBrc10 = 0xd626; diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 3ad3684bf807..e500e254da40 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -1176,14 +1176,6 @@ WW8TabBandDesc::WW8TabBandDesc( WW8TabBandDesc const & rBand ) // ReadDef reads the cell position and the borders of a band void WW8TabBandDesc::ReadDef(bool bVer67, const sal_uInt8* pS, short nLen) { - if (!bVer67) - { - //the ww8 version of this is unusual in masquerading as a srpm with a - //single byte len arg while it really has a word len arg, after this - //increment nLen is correct to describe the remaining amount of data - pS++; - } - --nLen; //reduce len by expected nCols arg if (nLen < 0) return; diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 0ab704073f29..c7aac65308ee 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -704,7 +704,7 @@ const wwSprmSearcher *wwSprmParser::GetWW8SprmSearcher() {NS_sprm::LN_TDefTable10, { 0, L_VAR} }, // "sprmTDefTable10" tap.rgdxaCenter, // tap.rgtc;complex InfoRow<NS_sprm::TDyaRowHeight>(), // tap.dyaRowHeight;dya;word; - InfoRow<NS_sprm::TDefTable>(), // tap.rgtc;complex + {NS_sprm::LN_TDefTable, { 0, L_VAR2} }, // "sprmTDefTable" tap.rgtc;complex InfoRow<NS_sprm::TDefTableShd80>(), // tap.rgshd;complex InfoRow<NS_sprm::TTlp>(), // tap.tlp;TLP;4 bytes; InfoRow<NS_sprm::TFBiDi>(), // ;;; @@ -8413,18 +8413,6 @@ sal_uInt16 wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm, nL = 2 + 4 * nDel + 3 * nIns; } break; - case 0xD608: - { - sal_uInt8 nIndex = 1 + mnDelta; - if (nIndex + 1 >= nRemLen) - { - SAL_WARN("sw.ww8", "sprm longer than remaining bytes, doc or parser is wrong"); - nL = 0; - } - else - nL = SVBT16ToUInt16(&pSprm[nIndex]); - break; - } default: switch (aSprm.nVari) { @@ -8448,8 +8436,13 @@ sal_uInt16 wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm, nCount = 0; } else + { nCount = SVBT16ToUInt16(&pSprm[nIndex]); - nL = static_cast< sal_uInt16 >(nCount + aSprm.nLen - 1); + SAL_WARN_IF(nCount < 1, "sw.ww8", "length should have been at least 1"); + if (nCount) + --nCount; + } + nL = static_cast<sal_uInt16>(nCount + aSprm.nLen); break; } default: