Bug 1354911 - Guard against null menu item names. r=sebastian, a=lizzard
authorJim Chen <nchen@mozilla.com>
Tue, 18 Apr 2017 17:42:58 -0400
changeset 379576 51b7cb864d3ed0e8f3d0afb092be149b0ad8a47b
parent 379575 d4686a554950979e0f34c5d4b86f2bfc04ae793b
child 379577 3dcabe8fddee9de352b62ced4f194dd7523b7624
push id1444
push userryanvm@gmail.com
push dateMon, 24 Apr 2017 19:43:08 +0000
treeherdermozilla-release@3dcabe8fddee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian, lizzard
bugs1354911
milestone53.0.1
Bug 1354911 - Guard against null menu item names. r=sebastian, a=lizzard Addons may give us invalid menu item names; bail instead of crashing in such cases.
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -1847,16 +1847,20 @@ public class BrowserApp extends GeckoApp
             case "Menu:Update":
                 updateAddonMenuItem(message.getInt("id") + ADDON_MENU_OFFSET,
                                     message.getBundle("options"));
                 break;
 
             case "Menu:Add":
                 final MenuItemInfo info = new MenuItemInfo();
                 info.label = message.getString("name");
+                if (info.label == null) {
+                    Log.e(LOGTAG, "Invalid menu item name");
+                    return;
+                }
                 info.id = message.getInt("id") + ADDON_MENU_OFFSET;
                 info.checked = message.getBoolean("checked", false);
                 info.enabled = message.getBoolean("enabled", true);
                 info.visible = message.getBoolean("visible", true);
                 info.checkable = message.getBoolean("checkable", false);
                 final int parent = message.getInt("parent", 0);
                 info.parent = parent <= 0 ? parent : parent + ADDON_MENU_OFFSET;
                 addAddonMenuItem(info);