aboutsummaryrefslogtreecommitdiffstats
path: root/screen_ui.cpp
diff options
context:
space:
mode:
authorAlistair Strachan <alistair.strachan@imgtec.com>2013-07-17 10:34:36 -0700
committerDoug Zongker <dougz@android.com>2013-11-18 09:51:32 -0800
commit9b8ae8038be65c2ec236bc04590716fbcd5363f6 (patch)
tree6340b6b0d4a5c088280eb8778ae13a355e8fa0da /screen_ui.cpp
parent9690e2b370f3f303ef75e1fd5c7fdbea8787d46a (diff)
downloadbootable_recovery-9b8ae8038be65c2ec236bc04590716fbcd5363f6.zip
bootable_recovery-9b8ae8038be65c2ec236bc04590716fbcd5363f6.tar.gz
bootable_recovery-9b8ae8038be65c2ec236bc04590716fbcd5363f6.tar.bz2
Fix rare crash seen when dereferencing backgroundIcon[NONE].
Because backgroundIcon[] is not initialized by the ScreenRecoveryUI constructor, it should be initialized explicitly to NULL in Init(). If it is not initialized, ScreenRecoveryUI::SetBackground() can fail for the NONE icon because the NULL test can fail and junk will be dereferenced. Change-Id: I4e3738d2e241ed90df43c984fb41e0072933f50a
Diffstat (limited to 'screen_ui.cpp')
-rw-r--r--screen_ui.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 8376341..be7abca 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -376,6 +376,7 @@ void ScreenRecoveryUI::Init()
text_cols = gr_fb_width() / char_width;
if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1;
+ backgroundIcon[NONE] = NULL;
LoadBitmap("icon_installing", &backgroundIcon[INSTALLING_UPDATE]);
backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE];
LoadBitmap("icon_error", &backgroundIcon[ERROR]);