소스 검색

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 달 전
부모
커밋
4cef5c996f
2개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 5
    0
      vncviewer/fltk/theme.cxx
  2. 1
    1
      vncviewer/fltk/theme.h

+ 5
- 0
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);

+ 1
- 1
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)

Loading…
취소
저장