Amiga: defensive NULL/bounds guards in menus and window creation
Guard the gd lookup in DoMenuScroll's GADGETUP/MOUSEMOVE branches so a window with no GadgetID==1 does not deref NULL; match the existing guards in the keyboard-scroll branches. In the keyboard selector and MENU_UNSELECT_ALL paths, only mutate items with canselect set so a non-selectable header cannot have its str stomped. Clamp MENU_LAST_PAGE topidx to >= 0. Make find_menu_item return NULL on negative idx instead of the head item. Guard the PROMPTFIRST data[] shuffle behind cury > 0. In amii_destroy_nhwindow's NHW_OVER branch use cw->win with a NULL guard instead of dereferencing amii_wins[WIN_OVER]->win blindly. Range-check the type argument to amii_create_nhwindow. Fix the *argv_in[1] precedence bug so the -L/-l flag does not deref NULL when it is the last argument. Wrap AllocAslRequest result in a NULL check before AslRequestTags/FreeAslRequest. Defensively bounds-check the idx argument to DispCol. Replace the -25937 signed-int literal in clipwin's PropInfo with the equivalent UWORD value 39599. Simplify amii_start_menu's free loop; switch DoMenuScroll's inventory title and Count display to Snprintf, and stop passing countString to pline as a format.
This commit is contained in:
+1
-1
@@ -197,7 +197,7 @@ static struct Gadget ClipXSIZE = {
|
||||
|
||||
static struct PropInfo ClipClipYSIZESInfo = {
|
||||
AUTOKNOB + FREEHORIZ, /* PropInfo flags */
|
||||
-25937, -1, /* horizontal and vertical pot values */
|
||||
39599, -1, /* horizontal and vertical pot values */
|
||||
10922, -1, /* horizontal and vertical body values */
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user