Browse Source

Fix 16-bit range check in TMenuItem::action_edit (#14834)

Jason Smith 5 years ago
parent
commit
534c105a7a
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      Marlin/src/lcd/menu/menu.h

+ 2
- 2
Marlin/src/lcd/menu/menu.h View File

@@ -191,8 +191,8 @@ class TMenuItem : MenuItemBase {
191 191
   public:
192 192
     static void action_edit(PGM_P const pstr, type_t * const ptr, const type_t minValue, const type_t maxValue, const screenFunc_t callback=nullptr, const bool live=false) {
193 193
       // Make sure minv and maxv fit within int16_t
194
-      const int32_t minv = _MAX(scale(minValue), INT_MIN),
195
-                    maxv = _MIN(scale(maxValue), INT_MAX);
194
+      const int32_t minv = _MAX(scale(minValue), INT16_MIN),
195
+                    maxv = _MIN(scale(maxValue), INT16_MAX);
196 196
       init(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv, edit, callback, live);
197 197
     }
198 198
     static void edit() { MenuItemBase::edit(to_string, load); }

Loading…
Cancel
Save