Resolves: rhbz#1013480 crash in EditLineList::operator[]

f41
Caolán McNamara 11 years ago
parent 293c722705
commit f6a91c9bb2

@ -0,0 +1,45 @@
From b9240ac3695c0f4b88c539721f13dc03b5afdabb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Tue, 1 Oct 2013 15:14:30 +0100
Subject: [PATCH] Resolves: rhbz#1013480 crash in EditLineList::operator[]
avoid crashing anyway, though unknown how to end up in
this scenario
Change-Id: Ib602c73478e5c4772cfef73f70c67ad22877a39f
---
editeng/source/editeng/impedit2.cxx | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 4bc6d70..8dd3e35 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -4119,10 +4119,13 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex
? GetYValue( rLSItem.GetInterLineSpace() ) : 0;
sal_uInt16 nCurIndex = 0;
- OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetEditCursor!" );
+ size_t nLineCount = pPortion->GetLines().Count();
+ OSL_ENSURE( nLineCount, "Empty ParaPortion in GetEditCursor!" );
+ if (nLineCount == 0)
+ return Rectangle();
const EditLine* pLine = NULL;
sal_Bool bEOL = ( nFlags & GETCRSR_ENDOFLINE ) ? sal_True : sal_False;
- for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
+ for (size_t nLine = 0; nLine < nLineCount; ++nLine)
{
const EditLine* pTmpLine = pPortion->GetLines()[nLine];
if ( ( pTmpLine->GetStart() == nIndex ) || ( pTmpLine->IsIn( nIndex, bEOL ) ) )
@@ -4141,7 +4144,7 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex
// Cursor at the End of the paragraph.
OSL_ENSURE( nIndex == nCurIndex, "Index dead wrong in GetEditCursor!" );
- pLine = pPortion->GetLines()[pPortion->GetLines().Count()-1];
+ pLine = pPortion->GetLines()[nLineCount-1];
nY -= pLine->GetHeight();
if ( !aStatus.IsOutliner() )
nY -= nSBL;
--
1.8.3.1

@ -43,7 +43,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.3
Release: 1%{?libo_prerelease}%{?dist}
Release: 2%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0
Group: Applications/Productivity
URL: http://www.libreoffice.org/default/
@ -258,6 +258,7 @@ Patch17: 0001-Make-charmap.cxx-compile-with-icu-4.4.patch
Patch18: 0001-Resolves-rhbz-1006850-crash-in-SwCommentRuler-GetCom.patch
Patch19: 0001-select-sheet-menu-as-a-right-click-popup-to-the-prev.patch
Patch20: 0001-Avoid-crash-when-a-comment-contains-data-but-no-text.patch
Patch21: 0001-Resolves-rhbz-1013480-crash-in-EditLineList-operator.patch
%define instdir %{_libdir}
%define baseinstdir %{instdir}/libreoffice
@ -1010,6 +1011,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
%patch18 -p1 -b .rhbz-1006850-crash-in-SwCommentRuler-GetCom.patch
%patch19 -p1 -b .select-sheet-menu-as-a-right-click-popup-to-the-prev.patch
%patch20 -p1 -b .Avoid-crash-when-a-comment-contains-data-but-no-text.patch
%patch21 -p1 -b .rhbz-1013480-crash-in-EditLineList-operator.patch
# TODO: check this
# these are horribly incomplete--empty translations and copied english
@ -2100,6 +2102,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif
%changelog
* Tue Oct 01 2013 Caolán McNamara <caolanm@redhat.com> - 1:4.1.2.3-2-UNBUILT
- Resolves: rhbz#1013480 crash in EditLineList::operator[]
* Mon Sep 30 2013 David Tardon <dtardon@redhat.com> - 1:4.1.2.3-1
- 4.1.2 rc3

Loading…
Cancel
Save