editeng/source/outliner/outliner.cxx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
New commits: commit 891d6e558e9b78a6e40980bc8cda3903c05126f5 Author: matteocam <matteo.campane...@gmail.com> Date: Wed Aug 13 16:11:07 2014 +0200 Check that overflowing paragraphs are within indices Change-Id: I0937753facfa051b4fc6b5d21479855879ba64a1 diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 1ecef6b..50fa881 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -2103,6 +2103,15 @@ OutlinerParaObject *Outliner::GetNonOverflowingParaObject() const sal_Int32 nCount = pEditEngine->GetOverflowingParaNum(); //sal_Int32 nCount = 1; + // Defensive check: oveflowing para index beyond actual # of paragraphs? + if ( nCount > GetParagraphCount()-1) { + fprintf(stderr, + "[Overflowing] Ops, trying to retrieve para %d when max index is %d\n", + nCount, + GetParagraphCount()-1); + return NULL; + } + if ( nCount == 0 ) // Only overflowing text return NULL; else if (nCount < 0) // No overflowing Text @@ -2130,8 +2139,17 @@ OutlinerParaObject *Outliner::GetNonOverflowingParaObject() const } OutlinerParaObject *Outliner::GetOverflowingParaObject() const { - if ( pEditEngine->GetOverflowingParaNum() >= 0) + if ( pEditEngine->GetOverflowingParaNum() >= 0) { + // Defensive check: oveflowing para index beyond actual # of paragraphs? + if ( pEditEngine->GetOverflowingParaNum() > GetParagraphCount()-1) { + fprintf(stderr, + "[Overflowing] Ops, trying to retrieve para %d when max index is %d\n", + nCount, + GetParagraphCount()-1); + return NULL; + } return CreateParaObject( pEditEngine->GetOverflowingParaNum() ); + } return NULL; /* _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits