From acecfab9dde94abe733d63260777007337b9aff0 Mon Sep 17 00:00:00 2001 From: "marc-andre@atc.tcs.com" Date: Fri, 8 Jul 2011 14:23:34 +0530 Subject: [PATCH] Fixed a segmentation fault in some edge cases --- sw/source/filter/ww8/ww8par6.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index a0e99f79cd6e..9fd4cd568fc6 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -915,6 +915,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; @@ -928,7 +929,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) { @@ -939,7 +941,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; } } }