Kaynağa Gözat

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.
pull/1659/head
Pierre Ossman 8 ay önce
ebeveyn
işleme
4cef5c996f
2 değiştirilmiş dosya ile 6 ekleme ve 1 silme
  1. 5
    0
      vncviewer/fltk/theme.cxx
  2. 1
    1
      vncviewer/fltk/theme.h

+ 5
- 0
vncviewer/fltk/theme.cxx Dosyayı Görüntüle

@@ -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);

+ 1
- 1
vncviewer/fltk/theme.h Dosyayı Görüntüle

@@ -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)

Loading…
İptal
Kaydet