Capping buffer size to std::numeric_limits<size_t>::max()
If stride is set to nonsensical (if stride has no meaning for the
particular buffer allocation) or to a stride size such that height *
stride * bpp would overflow size_t, approximate buffer size with stride
= width instead.
Bug: 142767215
Test: build, boot, GraphicBufferAllocation_test
Change-Id: Ia955246f529e46a80164d8b5c7bf59d0ec0def96
diff --git a/libs/ui/tests/Android.bp b/libs/ui/tests/Android.bp
index 0452f84..d2ad242 100644
--- a/libs/ui/tests/Android.bp
+++ b/libs/ui/tests/Android.bp
@@ -29,6 +29,26 @@
}
cc_test {
+ name: "GraphicBufferAllocator_test",
+ header_libs: [
+ "libdvr_headers",
+ "libnativewindow_headers",
+ ],
+ static_libs: [
+ "libgmock",
+ ],
+ shared_libs: [
+ "liblog",
+ "libui",
+ ],
+ srcs: [
+ "GraphicBufferAllocator_test.cpp",
+ "mock/MockGrallocAllocator.cpp",
+ ],
+ cflags: ["-Wall", "-Werror"],
+}
+
+cc_test {
name: "GraphicBuffer_test",
header_libs: [
"libdvr_headers",