summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2013-06-20 21:18:15 +0100
committerJon TURNEY <jon.turney@dronecode.org.uk>2013-06-20 21:18:15 +0100
commit6c4ea309427b9cd95a72185a84aee569a0a673ab (patch)
tree0fcec1539cb056eb6e1a11995ab86bbb14b0e2ab
parent47dcae3a26c3afef8baab9de63ea7509a9240b7e (diff)
parentc97ab680bc1bb72e7ea1cc64a90502ce5deba486 (diff)
Merge branch 'cygwin-patches-for-1.14' into cygwin-release-1.14
-rw-r--r--configure.ac14
-rw-r--r--hw/xwin/glx/Makefile.am4
-rw-r--r--hw/xwin/wmutil/icon_convert.c31
3 files changed, 39 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 45a319f61..cd3fb381e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,6 +82,16 @@ AC_PROG_YACC
AC_SYS_LARGEFILE
XORG_PROG_RAWCPP
+dnl we really need yacc and lex to build tarballs made by cygport directly from a git tag not 'make dist'
+AC_PATH_PROG(YACC_INST, $YACC)
+if test -z "$YACC_INST"; then
+ AC_MSG_ERROR([yacc not found])
+fi
+AC_PATH_PROG(LEX_INST, $LEX)
+if test -z "$LEX_INST"; then
+ AC_MSG_ERROR([lex not found])
+fi
+
# Quoted so that make will expand $(CWARNFLAGS) in makefiles to allow
# easier overrides at build time.
XSERVER_CFLAGS='$(CWARNFLAGS)'
@@ -1937,6 +1947,10 @@ if test "x$XWIN" = xyes; then
dnl XWin with AIGLX requires OpenGL spec files in order to generate wrapper code for native GL functions
if [test "x$XWIN" = xyes && test "x$AIGLX" = xyes] ; then
+ AC_CHECK_PROG(PYTHON, python, python)
+ if test -z "$PYTHON"; then
+ AC_MSG_ERROR([python not found])
+ fi
if test "x$KHRONOS_SPEC_DIR" = "xauto" ; then
PKG_CHECK_MODULES([KHRONOS_OPENGL_REGISTRY], [khronos-opengl-registry])
KHRONOS_SPEC_DIR=`pkg-config khronos-opengl-registry --variable=specdir`
diff --git a/hw/xwin/glx/Makefile.am b/hw/xwin/glx/Makefile.am
index 59f6879a7..f969af277 100644
--- a/hw/xwin/glx/Makefile.am
+++ b/hw/xwin/glx/Makefile.am
@@ -33,10 +33,10 @@ AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \
if XWIN_GLX_WINDOWS
generated_gl_wrappers.c: gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.spec $(KHRONOS_SPEC_DIR)/gl.tm
- $(AM_V_GEN)$(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/gl.spec --typemap=$(KHRONOS_SPEC_DIR)/gl.tm --dispatch-header=$(top_srcdir)/glx/dispatch.h --staticwrappers >generated_gl_wrappers.c
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/gl.spec --typemap=$(KHRONOS_SPEC_DIR)/gl.tm --dispatch-header=$(top_srcdir)/glx/dispatch.h --staticwrappers >generated_gl_wrappers.c
generated_wgl_wrappers.c: gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/wglext.spec $(KHRONOS_SPEC_DIR)/wgl.tm
- $(AM_V_GEN)$(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/wglext.spec --typemap=$(KHRONOS_SPEC_DIR)/wgl.tm --prefix=wgl --preresolve >generated_wgl_wrappers.c
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/wglext.spec --typemap=$(KHRONOS_SPEC_DIR)/wgl.tm --prefix=wgl --preresolve >generated_wgl_wrappers.c
endif
BUILT_SOURCES = generated_gl_wrappers.c generated_wgl_wrappers.c
diff --git a/hw/xwin/wmutil/icon_convert.c b/hw/xwin/wmutil/icon_convert.c
index 27037602f..328af2100 100644
--- a/hw/xwin/wmutil/icon_convert.c
+++ b/hw/xwin/wmutil/icon_convert.c
@@ -260,6 +260,10 @@ NetWMToWinIconAlpha(uint32_t * icon)
DIB_RGB_COLORS, (void **) &DIB_pixels, NULL,
0);
ReleaseDC(NULL, hdc);
+
+ if (!ii.hbmColor)
+ return NULL;
+
ii.hbmMask = CreateBitmap(width, height, 1, 1, NULL);
memcpy(DIB_pixels, pixels, height * width * 4);
@@ -370,7 +374,7 @@ winXIconToHICON(xcb_connection_t *conn, xcb_window_t id, int iconSize)
unsigned char *mask, *image = NULL, *imageMask;
unsigned char *dst, *src;
int planes, bpp, i;
- int biggest_size = 0;
+ unsigned int biggest_size = 0;
HDC hDC;
ICONINFO ii;
xcb_icccm_wm_hints_t hints;
@@ -381,9 +385,6 @@ winXIconToHICON(xcb_connection_t *conn, xcb_window_t id, int iconSize)
static int generation;
uint32_t *icon, *icon_data = NULL;
unsigned long int size;
- unsigned long int type;
- int format;
- unsigned long int left;
hDC = GetDC(GetDesktopWindow());
planes = GetDeviceCaps(hDC, PLANES);
@@ -416,10 +417,24 @@ winXIconToHICON(xcb_connection_t *conn, xcb_window_t id, int iconSize)
size = xcb_get_property_value_length(reply)/sizeof(uint32_t);
for (icon = icon_data; icon < &icon_data[size] && *icon;
icon = &icon[icon[0] * icon[1] + 2]) {
- /* Find an exact match to the size we require... */
+ winDebug("winXIconToHICON: %u x %u NetIcon\n", icon[0], icon[1]);
+
+ /* Icon data size may overflow an int and thus is bigger than the
+ property can possibly be */
+ if ((icon[0] > 0xFFFF) || (icon[1] > 0xFFFF)) {
+ winDebug("winXIconToHICON: malformed _NET_WM_ICON data\n");
+ break;
+ }
+
+ /* Icon data size is bigger than amount of data remaining */
+ if (&icon[icon[0] * icon[1] + 2] > &icon_data[size]) {
+ winDebug("winXIconToHICON: malformed _NET_WM_ICON data\n");
+ break;
+ }
+
+ /* Found an exact match to the size we require... */
if (icon[0] == iconSize && icon[1] == iconSize) {
- winDebug("winXIconToHICON: found %lu x %lu NetIcon\n", icon[0],
- icon[1]);
+ winDebug("winXIconToHICON: selected %d x %d NetIcon\n", iconSize);
hIcon = NetWMToWinIcon(bpp, icon);
break;
}
@@ -432,7 +447,7 @@ winXIconToHICON(xcb_connection_t *conn, xcb_window_t id, int iconSize)
if (!hIcon && biggest_icon) {
winDebug
- ("winXIconToHICON: selected %lu x %lu NetIcon for scaling to %u x %u\n",
+ ("winXIconToHICON: selected %u x %u NetIcon for scaling to %d x %d\n",
biggest_icon[0], biggest_icon[1], iconSize, iconSize);
hIcon = NetWMToWinIcon(bpp, biggest_icon);