diff options
author | marha <marha@users.sourceforge.net> | 2013-07-23 09:20:51 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-07-23 09:20:51 +0200 |
commit | 5c340ceb9356ea029dea53b73440268d4769d5a5 (patch) | |
tree | ae22100b15246769392280ed7b10eba3dc68b0ea /xorg-server/hw/dmx/dmx_glxvisuals.c | |
parent | b6aadb8490bdacf33196fa0898fe1247b9a8ee2c (diff) | |
download | vcxsrv-5c340ceb9356ea029dea53b73440268d4769d5a5.tar.gz vcxsrv-5c340ceb9356ea029dea53b73440268d4769d5a5.tar.bz2 vcxsrv-5c340ceb9356ea029dea53b73440268d4769d5a5.zip |
libX11 libXmu mesa xserver git update 23 July 2013
xserver commit d5ebe20f9ba9569351c4a41449866679fd60ba45
libX11 commit feb131b18aee31c2c125dc3275b0260940245882
libXmu commit d5dac08d65c4865f311cb62c161dbb1300eecd11
mesa commit 5a7bdd4b4173958c53109517b7c95f1039623e7e
Diffstat (limited to 'xorg-server/hw/dmx/dmx_glxvisuals.c')
-rw-r--r-- | xorg-server/hw/dmx/dmx_glxvisuals.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/xorg-server/hw/dmx/dmx_glxvisuals.c b/xorg-server/hw/dmx/dmx_glxvisuals.c index f903b7491..56bd67b6e 100644 --- a/xorg-server/hw/dmx/dmx_glxvisuals.c +++ b/xorg-server/hw/dmx/dmx_glxvisuals.c @@ -37,6 +37,7 @@ #include <GL/glxproto.h> #include <X11/extensions/Xext.h> #include <X11/extensions/extutil.h> +#include <limits.h> #include "dmx_glxvisuals.h" @@ -84,7 +85,10 @@ GetGLXVisualConfigs(Display * dpy, int screen, int *nconfigs) SyncHandle(); return NULL; } - props = (INT32 *) Xmalloc(nprops * __GLX_SIZE_CARD32); + if (nprops < (INT_MAX / __GLX_SIZE_CARD32)) + props = Xmalloc(nprops * __GLX_SIZE_CARD32); + else + props = NULL; if (!props) { UnlockDisplay(dpy); SyncHandle(); @@ -92,15 +96,16 @@ GetGLXVisualConfigs(Display * dpy, int screen, int *nconfigs) } /* Allocate memory for our config structure */ - config = (__GLXvisualConfig *) - Xmalloc(nvisuals * sizeof(__GLXvisualConfig)); + if (nvisuals < (INT_MAX / sizeof(__GLXvisualConfig))) + config = Xcalloc(nvisuals, sizeof(__GLXvisualConfig)); + else + config = NULL; if (!config) { free(props); UnlockDisplay(dpy); SyncHandle(); return NULL; } - memset(config, 0, nvisuals * sizeof(__GLXvisualConfig)); configs = config; num_good_visuals = 0; @@ -274,7 +279,10 @@ GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs) return NULL; } - attrs = (INT32 *) Xmalloc(2 * numAttribs * __GLX_SIZE_CARD32); + if (numAttribs < (INT_MAX / (2 * __GLX_SIZE_CARD32))) + attrs = Xmalloc(2 * numAttribs * __GLX_SIZE_CARD32); + else + attrs = NULL; if (!attrs) { UnlockDisplay(dpy); SyncHandle(); @@ -282,15 +290,16 @@ GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs) } /* Allocate memory for our config structure */ - config = (__GLXFBConfig *) - Xmalloc(numFBConfigs * sizeof(__GLXFBConfig)); + if (numFBConfigs < (INT_MAX / sizeof(__GLXFBConfig))) + config = Xcalloc(numFBConfigs, sizeof(__GLXFBConfig)); + else + config = NULL; if (!config) { free(attrs); UnlockDisplay(dpy); SyncHandle(); return NULL; } - memset(config, 0, numFBConfigs * sizeof(__GLXFBConfig)); fbconfigs = config; /* Convert attribute list into our format */ |