Bug 827687, patch 2: Be more careful walking segments. r=bzbarsky

This commit is contained in:
L. David Baron 2013-01-10 21:14:51 -08:00
parent aad277663c
commit 1fb6ad9b36

View File

@ -254,14 +254,22 @@ ElementAnimations::EnsureStyleRuleFor(TimeStamp aRefreshTime,
"has no segments");
// FIXME: Maybe cache the current segment?
const AnimationPropertySegment *segment = prop.mSegments.Elements();
const AnimationPropertySegment *segment = prop.mSegments.Elements(),
*segmentEnd = segment + prop.mSegments.Length();
while (segment->mToKey < positionInIteration) {
NS_ABORT_IF_FALSE(segment->mFromKey < segment->mToKey,
"incorrect keys");
++segment;
if (segment == segmentEnd) {
NS_ABORT_IF_FALSE(false, "incorrect positionInIteration");
break; // in order to continue in outer loop (just below)
}
NS_ABORT_IF_FALSE(segment->mFromKey == (segment-1)->mToKey,
"incorrect keys");
}
if (segment == segmentEnd) {
continue;
}
NS_ABORT_IF_FALSE(segment->mFromKey < segment->mToKey,
"incorrect keys");
NS_ABORT_IF_FALSE(segment - prop.mSegments.Elements() <