diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-30 17:50:38 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-30 23:20:20 +0200 |
commit | 299d90299d70fac0bed00bc63a65b29fc130b44a (patch) | |
tree | 7ab00624b37b482412e0d471a83db76ed36937b1 | |
parent | 2f95d196bf28471810ccce1503fd0ff379cccc4b (diff) |
fix bounds checking
Change-Id: I837cd043c7e5ee825feb1ede670ebd5ff912c487
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 8 |
1 files 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<OUString>& 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<cppu::OWeakObject*>(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<cppu::OWeakObject*>(this)); for(sal_uInt16 i = nStart; i < nRowCount; i++) { uno::Reference<table::XCell> xCell = getCellByPosition(0, i); @@ -4141,10 +4141,10 @@ void SwXCellRange::setColumnDescriptions(const uno::Sequence<OUString>& 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<cppu::OWeakObject*>(this)); const OUString* pArray = rColumnDesc.getConstArray(); - const sal_uInt16 nStart = m_bFirstRowAsLabel ? 1 : 0; for(sal_uInt16 i = nStart; i < nColumnCount; i++) { uno::Reference<table::XCell> xCell = getCellByPosition(0, i); |