diff options
author | marc-andre@atc.tcs.com <marc-andre@atc.tcs.com> | 2011-07-08 14:23:34 +0530 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-07-08 13:44:37 +0100 |
commit | 92c1de7d394bf02e8a344a81844b6534114c3343 (patch) | |
tree | 16a13ab171903844219f9e1fef72e05015e393ce | |
parent | 54a88fdf62d8e7507e7c3822e5fdddfeeeaa335b (diff) |
Fixed a segmentation fault in some edge cases
(cherry picked from commit 79f14410f2db7d186c8b7ee94b09e8e362e74dfd)
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 79ff1d5996..e393472854 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -917,6 +917,7 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/) aNewSection.maSep.fEvenlySpaced = ReadBSprm(pSep, (eVer <= ww::eWW7 ? 138 : 0x3005), 1) ? true : false; + const sal_uInt8 numrgda = SAL_N_ELEMENTS(aNewSection.maSep.rgdxaColumnWidthSpacing); if (aNewSection.maSep.ccolM1 > 0 && !aNewSection.maSep.fEvenlySpaced) { aNewSection.maSep.rgdxaColumnWidthSpacing[0] = 0; @@ -930,7 +931,8 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/) OSL_ENSURE( pSW, "+Sprm 136 (bzw. 0xF203) (ColWidth) fehlt" ); sal_uInt16 nWidth = pSW ? SVBT16ToShort(pSW + 1) : 1440; - aNewSection.maSep.rgdxaColumnWidthSpacing[++nIdx] = nWidth; + if (++nIdx < numrgda) + aNewSection.maSep.rgdxaColumnWidthSpacing[nIdx] = nWidth; if (i < nCols-1) { @@ -941,7 +943,8 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/) if( pSD ) { nWidth = SVBT16ToShort(pSD + 1); - aNewSection.maSep.rgdxaColumnWidthSpacing[++nIdx] = nWidth; + if (++nIdx < numrgda) + aNewSection.maSep.rgdxaColumnWidthSpacing[nIdx] = nWidth; } } } |