aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2023-08-17 14:46:04 +0200
committerPierre Ossman <ossman@cendio.se>2023-08-17 14:46:04 +0200
commit4cef5c996f18e3688bf13ec1ccee2f22ff888071 (patch)
tree3e65f0c4f0382b9f31f0957f38b96ff55bb68f80 /vncviewer
parentf632c47808c6540633068cbaf22407628980e34e (diff)
downloadtigervnc-4cef5c996f18e3688bf13ec1ccee2f22ff888071.tar.gz
tigervnc-4cef5c996f18e3688bf13ec1ccee2f22ff888071.zip
Move custom FLTK box types to valid range
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.
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/fltk/theme.cxx5
-rw-r--r--vncviewer/fltk/theme.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/vncviewer/fltk/theme.cxx b/vncviewer/fltk/theme.cxx
index f89933a3..22e04dc6 100644
--- a/vncviewer/fltk/theme.cxx
+++ b/vncviewer/fltk/theme.cxx
@@ -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);
diff --git a/vncviewer/fltk/theme.h b/vncviewer/fltk/theme.h
index 8793bd7c..b6a53218 100644
--- a/vncviewer/fltk/theme.h
+++ b/vncviewer/fltk/theme.h
@@ -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)