ReplicatedPG: add assert to snapset.clones search

CID 716943: Using invalid iterator (INVALIDATE_ITERATOR)At (27): Dereferencing
iterator "p" though it is already past the end of its container.

The assert ensures that p will not be dereferenced if invalid.

Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
Samuel Just 2012-09-25 13:54:12 -07:00
parent 10e1ac7bb9
commit 4f621a1a1f

View File

@ -1348,6 +1348,7 @@ ReplicatedPG::RepGather *ReplicatedPG::trim_object(const hobject_t &coid,
for (p = snapset.clones.begin(); p != snapset.clones.end(); p++)
if (*p == last)
break;
assert(p != snapset.clones.end());
object_stat_sum_t delta;
if (p != snapset.clones.begin()) {
// not the oldest... merge overlap into next older clone