diff options
author | marha <marha@users.sourceforge.net> | 2013-07-23 09:22:39 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-07-23 09:22:39 +0200 |
commit | a7c19a157eb0ba6a7789fe31f5bf7a2066d7966c (patch) | |
tree | d00e9cb782f34582f722e3da544b9c42b16ac850 /xorg-server/hw/dmx/dmx_glxvisuals.c | |
parent | 81d811ac780a2524fff09a516b6f0212c3f209a2 (diff) | |
parent | 5c340ceb9356ea029dea53b73440268d4769d5a5 (diff) | |
download | vcxsrv-a7c19a157eb0ba6a7789fe31f5bf7a2066d7966c.tar.gz vcxsrv-a7c19a157eb0ba6a7789fe31f5bf7a2066d7966c.tar.bz2 vcxsrv-a7c19a157eb0ba6a7789fe31f5bf7a2066d7966c.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
libX11 libXmu mesa xserver git update 23 July 2013
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 */ |