FLTK only allows 256 different box types, but it doesn't actually check this when registering new ones. Move our custom types to a valid range, and add an assert for good measure to make sure we don't overflow FLTK's internal structures.pull/1659/head
@@ -25,6 +25,8 @@ | |||
#include <config.h> | |||
#endif | |||
#include <assert.h> | |||
#ifdef WIN32 | |||
#include <windows.h> | |||
#endif | |||
@@ -271,6 +273,9 @@ void init_theme() | |||
const int PX = 2; | |||
const int PY = 2; | |||
// FLTK lacks a bounds check | |||
assert(THEME_ROUND_DOWN_BOX < 256); | |||
Fl::set_boxtype(THEME_UP_FRAME, theme_up_frame, PX, PY, PX*2, PY*2); | |||
Fl::set_boxtype(THEME_DOWN_FRAME, theme_down_frame, PX, PY, PX*2, PY*2); | |||
Fl::set_boxtype(THEME_THIN_UP_FRAME, theme_up_frame, PX, PY, PX*2, PY*2); |
@@ -26,7 +26,7 @@ | |||
#include <FL/Enumerations.H> | |||
#define _THEME_BOX_BASE (FL_FREE_BOXTYPE+1000) | |||
#define _THEME_BOX_BASE (FL_FREE_BOXTYPE+20) | |||
#define THEME_UP_FRAME (Fl_Boxtype)(_THEME_BOX_BASE+0) | |||
#define THEME_DOWN_FRAME (Fl_Boxtype)(_THEME_BOX_BASE+1) |