On 12/02/2014 12:10 AM, Valentin Corfu wrote:
> With this check we can avoid segmentation fault when invalid value used 
> during eglCreateContext.
> 
> Cc: mesa-sta...@lists.freedesktop.org
> Cc: mesa-dev@lists.freedesktop.org
> Signed-off-by: Valentin Corfu <valentinx.co...@intel.com>
> ---
>  src/egl/drivers/dri2/egl_dri2.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index d795a2f..819cb77 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -808,6 +808,11 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
> _EGLConfig *conf,
>  
>     (void) drv;
>  
> +   if (conf == NULL) {
> +      _eglError(EGL_BAD_CONFIG, "dri2_create_context");
> +      return NULL;
> +   }
> +

Can't conf be NULL when used with MESA_configless_context?  See also the
conf != NULL check at line 853.

Also, parameter validation etc. should go in eglCreateContext.

>     dri2_ctx = malloc(sizeof *dri2_ctx);
>     if (!dri2_ctx) {
>        _eglError(EGL_BAD_ALLOC, "eglCreateContext");
> 

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to