[Mesa-dev] [PATCH] egl: cut down static storage size for {Version, ClientAPI}String

Brian Paul brianp at vmware.com
Thu Mar 19 08:05:54 PDT 2015


On 03/18/2015 07:52 PM, Emil Velikov wrote:
> Both seems to be excessively long, namely:
>
> ClientAPIString can get up-to 47 based on current code, while the name
> of the driver can dictate the length of the VersionString, currently it
> is around 11. Let's pad each to 100, rather than the current 1000.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>   src/egl/main/egldisplay.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
> index 5a845d8..528c7c4 100644
> --- a/src/egl/main/egldisplay.h
> +++ b/src/egl/main/egldisplay.h
> @@ -154,8 +154,8 @@ struct _egl_display
>      _EGLExtensions Extensions; /**< Extensions supported */
>
>      /* these fields are derived from above */
> -   char VersionString[1000];                       /**< EGL_VERSION */
> -   char ClientAPIsString[1000];                    /**< EGL_CLIENT_APIS */
> +   char VersionString[100];                        /**< EGL_VERSION */
> +   char ClientAPIsString[100];                     /**< EGL_CLIENT_APIS */
>      char ExtensionsString[_EGL_MAX_EXTENSIONS_LEN]; /**< EGL_EXTENSIONS */
>
>      _EGLArray *Screens;
>

Looks like we either use _eglsnprintf() or an assertion to prevent/catch 
going out of bounds for these.

Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the mesa-dev mailing list