diff options
author | 2015-04-14 18:38:43 +0000 | |
---|---|---|
committer | 2015-04-14 18:38:43 +0000 | |
commit | e88e3669632972fedc85b23a2b108f56222c6eb4 (patch) | |
tree | ef0814150cc973e111a67341ee43dd2bfab116e0 | |
parent | 3bfe51d7901e99e7f122f76ed2708e2b67b71cf9 (diff) | |
parent | 6ea912c0494fe67d342224b737078dd90b991db6 (diff) |
am 6ea912c0: am ddabf640: am a3f8c2aa: Merge "Fix a memory corruption issue when vector resize"
* commit '6ea912c0494fe67d342224b737078dd90b991db6':
Fix a memory corruption issue when vector resize
-rw-r--r-- | libs/ui/Region.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp index 91fa21626f..53ef193713 100644 --- a/libs/ui/Region.cpp +++ b/libs/ui/Region.cpp @@ -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 // value greater than -1 (allowing the loop to execute), // 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) { // 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) { - dst.add(Rect(prev->right, top, right, bottom)); - right = prev->right; + if (prev.right > left && prev.right < right) { + dst.add(Rect(prev.right, top, right, bottom)); + right = prev.right; } - if (prev->left > left && prev->left < right) { - dst.add(Rect(prev->left, top, right, bottom)); - right = prev->left; + if (prev.left > left && prev.left < right) { + dst.add(Rect(prev.left, top, right, bottom)); + right = prev.left; } // if an entry in the previous span is too far right, nothing further left in the // current span will need it - if (prev->left >= right) { + if (prev.left >= right) { beginLastSpan = prevIndex; } } else { // 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) { - dst.add(Rect(left, top, prev->left, bottom)); - left = prev->left; + if (prev.left > left && prev.left < right) { + dst.add(Rect(left, top, prev.left, bottom)); + left = prev.left; } - if (prev->right > left && prev->right < right) { - dst.add(Rect(left, top, prev->right, bottom)); - left = prev->right; + if (prev.right > left && prev.right < right) { + dst.add(Rect(left, top, prev.right, bottom)); + left = prev.right; } // if an entry in the previous span is too far left, nothing further right in the // current span will need it - if (prev->right <= left) { + if (prev.right <= left) { beginLastSpan = prevIndex; } } |