Force-initialize potential padding area.

When collapsing our heap-and-stack boundaries, we round up to ensure
our padding math is still aligned on the remote side.  This rounding
can leak a small amount of uninitialized memory, so this change
force-initializes any potential padding area.

Bug: 213170822
Test: atest libandroidfw_tests
Change-Id: Ife6fcd1b74aaabd932a77ea42e0d0ad3a6b9cae6
This commit is contained in:
Jeff Sharkey
2022-06-07 13:14:04 -06:00
committed by Jeff Sharkey
parent c894c810d0
commit e33af7fe37

View File

@@ -227,6 +227,7 @@ status_t CursorWindow::writeToParcel(Parcel* parcel) {
if (!dest) goto fail;
memcpy(static_cast<uint8_t*>(dest),
static_cast<uint8_t*>(mData), mAllocOffset);
memset(static_cast<uint8_t*>(dest) + mAllocOffset, 0, 4);
memcpy(static_cast<uint8_t*>(dest) + compactedSize - slotsSize,
static_cast<uint8_t*>(mData) + mSlotsOffset, slotsSize);
}