[Mesa-dev] [PATCH] mesa/objectlabel: handle NULL src string

Dave Airlie airlied at gmail.com
Tue May 3 21:04:17 UTC 2016


Oops,

Reviewed-by: Dave Airlie <airlied at redhat.com>


On 4 May 2016 at 07:01, Mark Janes <mark.a.janes at intel.com> wrote:
> This prevents a crash when a NULL src is passed with a non-NULL length.
>
> fixes: dEQP-GLES31.functional.debug.object_labels.query_length_only
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95252
>
> Signed-off-by: Mark Janes <mark.a.janes at intel.com>
> ---
>  src/mesa/main/objectlabel.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
> index b77cb5c..5070b00 100644
> --- a/src/mesa/main/objectlabel.c
> +++ b/src/mesa/main/objectlabel.c
> @@ -104,13 +104,14 @@ copy_label(const GLchar *src, GLchar *dst, GLsizei *length, GLsizei bufSize)
>      * will be returned in <length>."
>      */
>
> +   if (src)
> +      labelLen = strlen(src);
> +
>     if (bufSize == 0) {
>        if (length)
> -         *length = strlen(src);
> +         *length = labelLen;
>        return;
>     }
> -   if (src)
> -      labelLen = strlen(src);
>
>     if (dst) {
>        if (src) {
> --
> 2.8.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list