Re: [Mesa-dev] [PATCH] Added NULL check in eglCreateContext
I re-submitted the patch according with suggested corrections. Thank you, Valentin Corfu On 29.11.2014 07:53, Matt Turner wrote: On Thu, Nov 27, 2014 at 1:59 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 --- 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..64eac90 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 (NULL == conf) { Don't do this. conf == NULL is fine. + _eglError(EGL_BAD_PARAMETER, "dri2_create_context"); + return NULL; + } + dri2_ctx = malloc(sizeof *dri2_ctx); if (!dri2_ctx) { _eglError(EGL_BAD_ALLOC, "eglCreateContext"); -- 1.9.1 I don't see any evidence in the spec that eglCreateContext can ever return EGL_BAD_PARAMETER. I do see If config is not a valid EGLConfig, or does not support the requested client API , then an EGL_BAD_CONFIG error is generated And the patch should be prefixed with "egl: ". ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Added NULL check in eglCreateContext
On Thu, Nov 27, 2014 at 1:59 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 > --- > 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..64eac90 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 (NULL == conf) { Don't do this. conf == NULL is fine. > + _eglError(EGL_BAD_PARAMETER, "dri2_create_context"); > + return NULL; > + } > + > dri2_ctx = malloc(sizeof *dri2_ctx); > if (!dri2_ctx) { >_eglError(EGL_BAD_ALLOC, "eglCreateContext"); > -- > 1.9.1 I don't see any evidence in the spec that eglCreateContext can ever return EGL_BAD_PARAMETER. I do see > If config is not a valid EGLConfig, or does not support the requested client > API , then an EGL_BAD_CONFIG error is generated And the patch should be prefixed with "egl: ". ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev