diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-04 16:02:49 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-07-08 11:48:54 +0000 |
commit | d791e45741a7ff36c0942a600d2ee0c7fabcd06a (patch) | |
tree | d8c3f7c97d536033cf426b1deddf19e1c9d38bdc | |
parent | coverity#1158240 Dereference before null check (diff) | |
download | core-d791e45741a7ff36c0942a600d2ee0c7fabcd06a.tar.gz core-d791e45741a7ff36c0942a600d2ee0c7fabcd06a.zip |
DOC import: fix nested comments
See 2.9.70 (FBKF) in the spec, the ibkl field should be used to find the
position in PlcfBkf.
Previously we assumed that PlcfBkl and PlcfBkf is parallel for
annotations, as but that's not true for nested comments.
Change-Id: I76a6a757b41d2f9b7fe7fe9c9e01a92c251f7b32
(cherry picked from commit 5cfda4f4de8da82485e27b1f0f0d94211d3b4d95)
Reviewed-on: https://gerrit.libreoffice.org/10138
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 14 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index ed42bf42cf95..0ba789bdce78 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2162,7 +2162,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) if (nAtnIndex != -1) { WW8_CP nStart = GetAnnotationStart(nAtnIndex); - WW8_CP nEnd = GetAnnotationEnd(nAtnIndex); + WW8_CP nEnd = GetAnnotationEnd(GetAnnotationEndIndex(nAtnIndex)); sal_Int32 nLen = nEnd - nStart; if( nLen ) { @@ -5951,6 +5951,18 @@ int SwWW8ImplReader::GetAnnotationIndex(sal_uInt32 nTag) return -1; } +sal_uInt16 SwWW8ImplReader::GetAnnotationEndIndex(sal_uInt16 nStart) +{ + WW8_CP nStartAkt; + void* p; + if (mpAtnStarts->GetData(nStart, nStartAkt, p) && p) + { + // p is an FBKF, and its first 2 bytes is the ibkl member, which is the end index. + return SVBT16ToShort(*((SVBT16*)p)); + } + return nStart; +} + WW8_CP SwWW8ImplReader::GetAnnotationStart(int nIndex) { if (!mpAtnStarts.get() && pWwFib->lcbPlcfAtnbkf) diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 772da4c98091..9434c2e4c89e 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1635,6 +1635,8 @@ private: const OUString* GetAnnotationAuthor(sal_uInt16 nIdx); int GetAnnotationIndex(sal_uInt32 nTag); + /// Return the end index based on the start one. + sal_uInt16 GetAnnotationEndIndex(sal_uInt16 nStart); WW8_CP GetAnnotationStart(int nIndex); WW8_CP GetAnnotationEnd(int nIndex); |