summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Ceballos <pceballos@google.com>2016-07-13 14:11:57 -0700
committergitbuildkicker <android-build@google.com>2016-08-16 15:52:32 -0700
commit07cd4cdf216f5120a7c593991d54492f8ae29f6f (patch)
tree65d5f414bb527625e27dc64868c51e41035704f2
parent54cb02ad733fb71b1bdf78590428817fb780aff8 (diff)
downloadframeworks_native-07cd4cdf216f5120a7c593991d54492f8ae29f6f.zip
frameworks_native-07cd4cdf216f5120a7c593991d54492f8ae29f6f.tar.gz
frameworks_native-07cd4cdf216f5120a7c593991d54492f8ae29f6f.tar.bz2
Region: Detect malicious overflow in unflatten
Bug 29983260 Change-Id: Ib6e1cb8ae279010c5e9960aaa03513f55b7d873b
-rw-r--r--libs/ui/Region.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index 3810da4..cfed7a9 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -795,6 +795,11 @@ status_t Region::unflatten(void const* buffer, size_t size) {
return NO_MEMORY;
}
+ if (numRects > (UINT32_MAX / sizeof(Rect))) {
+ android_errorWriteWithInfoLog(0x534e4554, "29983260", -1, NULL, 0);
+ return NO_MEMORY;
+ }
+
Region result;
result.mStorage.clear();
for (size_t r = 0; r < numRects; ++r) {