aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar herb <herb@google.com>2017-01-25 20:37:09 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-26 02:07:06 +0000
commit98829b979119297bd9dbbe9313ba98ea0b3289af (patch)
tree318bb05ef616956afcf41885730b3eeb5ddfb0a9
parent65a17539d2ab1866b2c8252155b0a7fbe127d861 (diff)
Check that the upper bits are correct in the SkArenaAlloc footer.
TBR=mtklein@google.com Change-Id: I8dc21778d1b8b24dd9d7b6919bb7e2bcfe090e82 Reviewed-on: https://skia-review.googlesource.com/7588 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Herb Derby <herb@google.com>
-rw-r--r--src/core/SkArenaAlloc.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/SkArenaAlloc.cpp b/src/core/SkArenaAlloc.cpp
index 90b703721e..95f07da9eb 100644
--- a/src/core/SkArenaAlloc.cpp
+++ b/src/core/SkArenaAlloc.cpp
@@ -68,6 +68,9 @@ void SkArenaAlloc::reset() {
void SkArenaAlloc::installFooter(FooterAction* action, uint32_t padding) {
SkASSERT(padding < 64);
int64_t actionInt = (int64_t)(intptr_t)action;
+
+ // The top 14 bits should be either all 0s or all 1s. Check this.
+ SkASSERT((actionInt << 6) >> 6 == actionInt);
Footer encodedFooter = (actionInt << 6) | padding;
memmove(fCursor, &encodedFooter, sizeof(Footer));
fCursor += sizeof(Footer);