浏览代码

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

Jason Smith 5 年前
父节点
当前提交
534c105a7a
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      Marlin/src/lcd/menu/menu.h

+ 2
- 2
Marlin/src/lcd/menu/menu.h 查看文件

191
   public:
191
   public:
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) {
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
       // Make sure minv and maxv fit within int16_t
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
       init(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv, edit, callback, live);
196
       init(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv, edit, callback, live);
197
     }
197
     }
198
     static void edit() { MenuItemBase::edit(to_string, load); }
198
     static void edit() { MenuItemBase::edit(to_string, load); }

正在加载...
取消
保存