diff options
author | Pierre-Eric Pelloux-Prayer <pierre-eric@lanedo.com> | 2013-05-27 10:45:08 +0200 |
---|---|---|
committer | Pierre-Eric Pelloux-Prayer <pierre-eric@lanedo.com> | 2013-06-03 09:24:21 +0200 |
commit | 1fadebef054b811d8d6487d45d76dea1990e1268 (patch) | |
tree | 2ba1bb74b743c793a4e51342d80a4fd6e3dfc12f /sw | |
parent | 8cc9383fe7dbb81c28da6c843638c04c803cc8ab (diff) |
fdo#57874: verify GetRedlinePos return value before usage
Make sure return value of GetRedlinePos is checked each time
before usage.
Fix crash in Redline dialog.
Change-Id: I5586d8ddc1a7905c524a522addc89969e704048d
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/misc/redlndlg.cxx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx index 7885bb402ec2..5ea478f2891d 100644 --- a/sw/source/ui/misc/redlndlg.cxx +++ b/sw/source/ui/misc/redlndlg.cxx @@ -293,10 +293,15 @@ void SwRedlineAcceptDlg::InitAuthors() SvTreeListEntry* pSelEntry = pTable->FirstSelected(); while (pSelEntry) { + // find the selected redline + // (fdo#57874: ignore, if the redline is already gone) sal_uInt16 nPos = GetRedlinePos(*pSelEntry); - const SwRedline& rRedln = pSh->GetRedline( nPos ); + if( nPos != USHRT_MAX ) + { + const SwRedline& rRedln = pSh->GetRedline( nPos ); - bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType(); + bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType(); + } pSelEntry = pTable->NextSelected(pSelEntry); } @@ -1007,7 +1012,7 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl) sal_uInt16 nPos = GetRedlinePos(*pTopEntry); // disable commenting for protected areas - if ((pRed = pSh->GotoRedline(nPos, sal_True)) != 0) + if (nPos != USHRT_MAX && (pRed = pSh->GotoRedline(nPos, sal_True)) != 0) { if( pSh->IsCrsrPtAtEnd() ) pSh->SwapPam(); @@ -1048,6 +1053,10 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl) pEntry = pTable->GetParent(pEntry); sal_uInt16 nPos = GetRedlinePos(*pEntry); + + if (nPos == USHRT_MAX) + break; + const SwRedline &rRedline = pSh->GetRedline(nPos); |