am a3f8c2aa
: Merge "Fix a memory corruption issue when vector resize"
* commit 'a3f8c2aaf1bb82b436306f65b86d25d4ea955d4d': Fix a memory corruption issue when vector resize
This commit is contained in:
commit
ddabf64029
@ -130,43 +130,42 @@ static void reverseRectsResolvingJunctions(const Rect* begin, const Rect* end,
|
|||||||
// prevIndex can't be -1 here because if endLastSpan is set to a
|
// prevIndex can't be -1 here because if endLastSpan is set to a
|
||||||
// value greater than -1 (allowing the loop to execute),
|
// value greater than -1 (allowing the loop to execute),
|
||||||
// beginLastSpan (and therefore prevIndex) will also be increased
|
// beginLastSpan (and therefore prevIndex) will also be increased
|
||||||
const Rect* prev = &dst[static_cast<size_t>(prevIndex)];
|
const Rect prev = dst[static_cast<size_t>(prevIndex)];
|
||||||
|
|
||||||
if (spanDirection == direction_RTL) {
|
if (spanDirection == direction_RTL) {
|
||||||
// iterating over previous span RTL, quit if it's too far left
|
// iterating over previous span RTL, quit if it's too far left
|
||||||
if (prev->right <= left) break;
|
if (prev.right <= left) break;
|
||||||
|
|
||||||
if (prev->right > left && prev->right < right) {
|
if (prev.right > left && prev.right < right) {
|
||||||
dst.add(Rect(prev->right, top, right, bottom));
|
dst.add(Rect(prev.right, top, right, bottom));
|
||||||
right = prev->right;
|
right = prev.right;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prev->left > left && prev->left < right) {
|
if (prev.left > left && prev.left < right) {
|
||||||
dst.add(Rect(prev->left, top, right, bottom));
|
dst.add(Rect(prev.left, top, right, bottom));
|
||||||
right = prev->left;
|
right = prev.left;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if an entry in the previous span is too far right, nothing further left in the
|
// if an entry in the previous span is too far right, nothing further left in the
|
||||||
// current span will need it
|
// current span will need it
|
||||||
if (prev->left >= right) {
|
if (prev.left >= right) {
|
||||||
beginLastSpan = prevIndex;
|
beginLastSpan = prevIndex;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// iterating over previous span LTR, quit if it's too far right
|
// iterating over previous span LTR, quit if it's too far right
|
||||||
if (prev->left >= right) break;
|
if (prev.left >= right) break;
|
||||||
|
|
||||||
if (prev->left > left && prev->left < right) {
|
if (prev.left > left && prev.left < right) {
|
||||||
dst.add(Rect(left, top, prev->left, bottom));
|
dst.add(Rect(left, top, prev.left, bottom));
|
||||||
left = prev->left;
|
left = prev.left;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prev->right > left && prev->right < right) {
|
if (prev.right > left && prev.right < right) {
|
||||||
dst.add(Rect(left, top, prev->right, bottom));
|
dst.add(Rect(left, top, prev.right, bottom));
|
||||||
left = prev->right;
|
left = prev.right;
|
||||||
}
|
}
|
||||||
// if an entry in the previous span is too far left, nothing further right in the
|
// if an entry in the previous span is too far left, nothing further right in the
|
||||||
// current span will need it
|
// current span will need it
|
||||||
if (prev->right <= left) {
|
if (prev.right <= left) {
|
||||||
beginLastSpan = prevIndex;
|
beginLastSpan = prevIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user