summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-03-13 22:23:31 +0100
committerEike Rathke <erack@redhat.com>2018-03-13 22:36:27 +0100
commitf59cf3874a91158e82fc9d09d28d23e053ad06a3 (patch)
tree104c894ed4e41b4f1e4c046e33ace5e073177a54
parent99aaa4b0b88100c8db03b32e072cff0193ad0953 (diff)
ofz#6845 use of "deleted" ScRange
If nOverPos<i and i was last element, the next pOver=&rRange was invalid, though not deleted because std::vector::erase() does not reallocate. Change-Id: I22d9302e2d45403dd47ac1947d2cf003b3a4f291
-rw-r--r--sc/source/core/tool/rangelst.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 3b68a8fd5032..84c6764ab79a 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -320,7 +320,11 @@ Label_Range_Join:
if ( bIsInList )
{ // delete range pOver within the list
if (nOverPos != std::numeric_limits<size_t>::max())
+ {
Remove(nOverPos);
+ if (nOverPos < i)
+ --i;
+ }
else
{
for (size_t nOver = 0, nRanges = maRanges.size(); nOver < nRanges; ++nOver)
@@ -334,7 +338,7 @@ Label_Range_Join:
}
}
bJoinedInput = true;
- pOver = &rRange;
+ pOver = &maRanges[i];
bIsInList = true;
goto Label_Range_Join;
}