From 2201d08f8dc9d48bcb4bd13690e061013bdeeb91 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Mon, 26 Nov 2018 15:46:05 -0800 Subject: minui: Fix a wrong arg in calling GRSurface::Create(). This is a bug introduced while refactoring init_display_surface(), in [1]. As a result, user of res_create_multi_display_surface(), which is effectively `charger` right now, crashes due to buffer overrun. This CL fixes the wrong arg and adds a sanity test for res_create_multi_display_surface(). The testdata (battery_scale.png) is copied from system/core/healthd/images/battery_scale.png. [1] commit 44820ac1e31ffa029ab5baa71238a11b6db3e6cc. Bug: 119122296 Test: Run recovery_unit_test on marlin. Test: Build and boot into charger mode on blueline. Verify that `charger` no longer crashes. Change-Id: Ib6d083e1512a9c3c6eb63874d26d22658921d693 --- minui/resources.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'minui/resources.cpp') diff --git a/minui/resources.cpp b/minui/resources.cpp index c7af1904d..057d3fd03 100644 --- a/minui/resources.cpp +++ b/minui/resources.cpp @@ -261,7 +261,7 @@ int res_create_multi_display_surface(const char* name, int* frames, int* fps, for (int i = 0; i < *frames; ++i) { auto height_per_frame = height / *frames; auto created_surface = - GRSurface::Create(width, height_per_frame, width * 4, 4, width * height_per_frame); + GRSurface::Create(width, height_per_frame, width * 4, 4, width * height_per_frame * 4); if (!created_surface) { result = -8; goto exit; -- cgit v1.2.3