From 8f25bbc93c32d99e4e16d6d4ca1ea0b3aa23d137 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 6 Jun 2018 19:24:17 +0100 Subject: [PATCH] Fix use of HasBit beyond field width in ShowDropDownMenu masks --- src/widgets/dropdown.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 756d8395ac..b5c6f0bf60 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -485,8 +485,8 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt DropDownList *list = new DropDownList(); for (uint i = 0; strings[i] != INVALID_STRING_ID; i++) { - if (!HasBit(hidden_mask, i)) { - *list->Append() = new DropDownListStringItem(strings[i], i, HasBit(disabled_mask, i)); + if (i >= 32 || !HasBit(hidden_mask, i)) { + *list->Append() = new DropDownListStringItem(strings[i], i, i < 32 && HasBit(disabled_mask, i)); } }