From 9b8ae8038be65c2ec236bc04590716fbcd5363f6 Mon Sep 17 00:00:00 2001 From: Alistair Strachan Date: Wed, 17 Jul 2013 10:34:36 -0700 Subject: 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 --- screen_ui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/screen_ui.cpp b/screen_ui.cpp index 8376341c3..be7abca1d 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]); -- cgit v1.2.3