summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lee Shombert <shombert@google.com> 2025-03-14 10:02:08 -0700
committer Lee Shombert <shombert@google.com> 2025-03-14 10:41:20 -0700
commit9dc64621d896d05fcb0e6f45792a307fde130823 (patch)
tree3ad74964d7acbb016e4aeed568a5a3f61531efee
parent69001a0a44c062b299f2fe0e8499cdbeb808a323 (diff)
Zero-initialize CursorWindow buffer
Zero-initialize mData in CursorWindow::create(). The caller might not fully fill that buffer before sending it to the remote end. It is not necessary to zero-initialize in CursorWindow::createFromParcel(), since the buffer is immediately filled from the far end. Flag: EXEMPT bug-fix Bug: 309407957 Test: atest * libandroidfw_tests * FrameworksCoreTests:android.database * CtsDatabaseTestCases Change-Id: I755240b0e3ba185c01036a5e00c8785d2e1ac11a
-rw-r--r--libs/androidfw/CursorWindow.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/androidfw/CursorWindow.cpp b/libs/androidfw/CursorWindow.cpp
index a592749c5398..6e11d430c5ea 100644
--- a/libs/androidfw/CursorWindow.cpp
+++ b/libs/androidfw/CursorWindow.cpp
@@ -55,7 +55,7 @@ status_t CursorWindow::create(const String8 &name, size_t inflatedSize, CursorWi
window->mName = name;
window->mSize = std::min(kInlineSize, inflatedSize);
window->mInflatedSize = inflatedSize;
- window->mData = malloc(window->mSize);
+ window->mData = calloc(window->mSize, 1);
if (!window->mData) goto fail;
window->mReadOnly = false;