[Mesa-dev] [PATCH] mesa/objectlabel: don't do memcpy if bufSize is 0 (v2)
Alejandro Piñeiro
apinheiro at igalia.com
Tue May 3 08:41:11 UTC 2016
As far as I see the spec itself doesn't include what happens if bufSize
is zero (note that is included as a big commet) (spec bug?), but I agree
that the more reasonable is applying what happens when src is null but
label is not.
Or in other words: LGTM
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
On 03/05/16 09:40, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This prevents GL43-CTS.khr_debug.labels_non_debug from
> memcpying all over the stack and crashing.
>
> v2: actually fix the test.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/mesa/main/objectlabel.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
> index b622d6a..b77cb5c 100644
> --- a/src/mesa/main/objectlabel.c
> +++ b/src/mesa/main/objectlabel.c
> @@ -104,6 +104,11 @@ copy_label(const GLchar *src, GLchar *dst, GLsizei *length, GLsizei bufSize)
> * will be returned in <length>."
> */
>
> + if (bufSize == 0) {
> + if (length)
> + *length = strlen(src);
> + return;
> + }
> if (src)
> labelLen = strlen(src);
>
More information about the mesa-dev
mailing list