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>
This commit is contained in:
herb 2017-01-25 20:37:09 -05:00 committed by Skia Commit-Bot
parent 65a17539d2
commit 98829b9791

View File

@ -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);