Kaydet (Commit) 299d9029 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

fix bounds checking

Change-Id: I837cd043c7e5ee825feb1ede670ebd5ff912c487
üst 2f95d196
...@@ -4120,10 +4120,10 @@ void SwXCellRange::setRowDescriptions(const uno::Sequence<OUString>& rRowDesc) ...@@ -4120,10 +4120,10 @@ void SwXCellRange::setRowDescriptions(const uno::Sequence<OUString>& rRowDesc)
const sal_uInt16 nRowCount = getRowCount(); const sal_uInt16 nRowCount = getRowCount();
if(!m_bFirstColumnAsLabel) if(!m_bFirstColumnAsLabel)
return; // if there are no labels we cannot set descriptions 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 OUString* pArray = rRowDesc.getConstArray();
const sal_uInt16 nStart = m_bFirstColumnAsLabel ? 1 : 0; 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++) for(sal_uInt16 i = nStart; i < nRowCount; i++)
{ {
uno::Reference<table::XCell> xCell = getCellByPosition(0, i); uno::Reference<table::XCell> xCell = getCellByPosition(0, i);
...@@ -4141,10 +4141,10 @@ void SwXCellRange::setColumnDescriptions(const uno::Sequence<OUString>& rColumnD ...@@ -4141,10 +4141,10 @@ void SwXCellRange::setColumnDescriptions(const uno::Sequence<OUString>& rColumnD
const sal_uInt16 nColumnCount = getColumnCount(); const sal_uInt16 nColumnCount = getColumnCount();
if(!m_bFirstRowAsLabel) if(!m_bFirstRowAsLabel)
return; // if there are no labels we cannot set descriptions 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)); throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
const OUString* pArray = rColumnDesc.getConstArray(); const OUString* pArray = rColumnDesc.getConstArray();
const sal_uInt16 nStart = m_bFirstRowAsLabel ? 1 : 0;
for(sal_uInt16 i = nStart; i < nColumnCount; i++) for(sal_uInt16 i = nStart; i < nColumnCount; i++)
{ {
uno::Reference<table::XCell> xCell = getCellByPosition(0, i); uno::Reference<table::XCell> xCell = getCellByPosition(0, i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment