summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2012-08-07 12:16:35 -0700
committerIan Romanick <ian.d.romanick@intel.com>2012-08-13 17:23:48 -0700
commita81e4b3e9272f70ab9074f1c133dda94c58daeff (patch)
treed6f071d0ac3c1e64bcbae4ee40cba7b2f5a46d60 /src
parent2b636243265f0f09b7fd8d42046119222a63cad4 (diff)
i830: Validate API and version before calling i830CreateContext
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index cdae702adf5..877d11b709e 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -736,9 +736,27 @@ intelCreateContext(gl_api api,
success = i915CreateContext(api, mesaVis, driContextPriv,
sharedContextPrivate);
} else {
+ switch (api) {
+ case API_OPENGL:
+ if (major_version > 1 || minor_version > 3) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ return false;
+ }
+ break;
+ case API_OPENGLES:
+ break;
+ default:
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return false;
+ }
+
intelScreen->no_vbo = true;
success = i830CreateContext(mesaVis, driContextPriv,
sharedContextPrivate);
+ if (!success) {
+ *error = __DRI_CTX_ERROR_NO_MEMORY;
+ return false;
+ }
}
#else
success = brwCreateContext(api, mesaVis,