From 299d90299d70fac0bed00bc63a65b29fc130b44a Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Mon, 30 Mar 2015 17:50:38 +0200 Subject: fix bounds checking Change-Id: I837cd043c7e5ee825feb1ede670ebd5ff912c487 --- sw/source/core/unocore/unotbl.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index f1f5cca3ab38..38b2d0577ea0 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -4120,10 +4120,10 @@ void SwXCellRange::setRowDescriptions(const uno::Sequence& rRowDesc) const sal_uInt16 nRowCount = getRowCount(); if(!m_bFirstColumnAsLabel) return; // if there are no labels we cannot set descriptions - if(!nRowCount || rRowDesc.getLength() < nRowCount) - throw uno::RuntimeException("Illegal arguments", static_cast(this)); const OUString* pArray = rRowDesc.getConstArray(); const sal_uInt16 nStart = m_bFirstColumnAsLabel ? 1 : 0; + if(!nRowCount || rRowDesc.getLength() + nStart < nRowCount) + throw uno::RuntimeException("Illegal arguments", static_cast(this)); for(sal_uInt16 i = nStart; i < nRowCount; i++) { uno::Reference xCell = getCellByPosition(0, i); @@ -4141,10 +4141,10 @@ void SwXCellRange::setColumnDescriptions(const uno::Sequence& rColumnD const sal_uInt16 nColumnCount = getColumnCount(); if(!m_bFirstRowAsLabel) return; // if there are no labels we cannot set descriptions - if(!nColumnCount || rColumnDesc.getLength() < nColumnCount) + const sal_uInt16 nStart = m_bFirstRowAsLabel ? 1 : 0; + if(!nColumnCount || rColumnDesc.getLength() + nStart < nColumnCount) throw uno::RuntimeException("Illegal arguments", static_cast(this)); const OUString* pArray = rColumnDesc.getConstArray(); - const sal_uInt16 nStart = m_bFirstRowAsLabel ? 1 : 0; for(sal_uInt16 i = nStart; i < nColumnCount; i++) { uno::Reference xCell = getCellByPosition(0, i); -- cgit