[Mesa-dev] [PATCH mesa 4/5] egl: add assert on the max length of the extension string

Tapani Pälli tapani.palli at intel.com
Thu Mar 2 06:56:55 UTC 2017


On 03/02/2017 01:31 AM, Eric Engestrom wrote:
> Signed-off-by: Eric Engestrom <eric at engestrom.ch>
> ---
>  src/egl/main/eglapi.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index 274dcde01d..2d7077f88b 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -467,6 +467,7 @@ _eglAppendExtension(char **str, const char *ext)
>  static void
>  _eglCreateExtensionsString(_EGLDisplay *dpy)
>  {
> +   unsigned max_extstr_length = 0;
>  #define _EGL_CHECK_EXTENSION(ext)                                          \
>     do {                                                                    \
>        if (dpy->Extensions.ext) {                                           \
> @@ -474,6 +475,7 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
>                  dpy->ExtensionsString + _EGL_MAX_EXTENSIONS_LEN);          \
>           _eglAppendExtension(&exts, "EGL_" #ext);                          \
>        }                                                                    \
> +      max_extstr_length += strlen("EGL_" #ext " ");                        \

Doesn't this try to verify the same thing as previous assert, the length 
of the complete string? Maybe we should just add that ' ' character to 
the assert above and it should match the check?


>     } while (0)
>
>     char *exts = dpy->ExtensionsString;
> @@ -527,6 +529,8 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
>     _EGL_CHECK_EXTENSION(WL_bind_wayland_display);
>     _EGL_CHECK_EXTENSION(WL_create_wayland_buffer_from_image);
>
> +   assert(max_extstr_length < _EGL_MAX_EXTENSIONS_LEN);
> +
>  #undef _EGL_CHECK_EXTENSION
>  }
>
>


More information about the mesa-dev mailing list