sot/source/sdstor/stgstrms.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
New commits: commit 75e7643e22bcf674739ca890bfc06f80e872624b Author: Caolán McNamara <caol...@redhat.com> Date: Thu May 10 21:46:53 2012 +0100 Related: fdo#47644 get out of bounds conditions right Change-Id: Icac9a8337296f92af5007a051f00388a64955178 diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index 88bc416..3ee485e 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -455,17 +455,14 @@ sal_Bool StgStrm::Pos2Page( sal_Int32 nBytePos ) } else { - size_t nBgnDistance = std::distance(m_aPagesCache.begin(), aI); + size_t nBgnIndex = std::distance(m_aPagesCache.begin(), aI); + size_t nIndex = nBgnIndex + nRel; - size_t nIndex = nBgnDistance + nRel; - - if (nIndex > m_aPagesCache.size()) - { - nRel = m_aPagesCache.size() - nBgnDistance; + if (nIndex >= m_aPagesCache.size()) nIndex = m_aPagesCache.size() - 1; - } - else - nRel = 0; + + size_t nSuccessfulStepsTaken = nIndex - nBgnIndex; + nRel -= nSuccessfulStepsTaken; nLast = nIndex ? m_aPagesCache[nIndex - 1] : STG_EOF; nBgn = m_aPagesCache[nIndex];
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits