From: Chia-I Wu Date: Wed, 14 Jul 2010 16:31:39 +0000 (+0800) Subject: egl: Return the correct array size in _eglFlattenArray. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d7284b45e247d620e3a80bfc9182ff9c45bb7c62;p=mesa.git egl: Return the correct array size in _eglFlattenArray. The function is used by _eglGetConfigs and _eglGetScreens. The array size should not be limited by the buffer size when the buffer is NULL. This fixes fdo bug #29052. --- diff --git a/src/egl/main/eglarray.c b/src/egl/main/eglarray.c index 781d07fc1ce..d686fa162d5 100644 --- a/src/egl/main/eglarray.c +++ b/src/egl/main/eglarray.c @@ -166,8 +166,11 @@ _eglFlattenArray(_EGLArray *array, void *buffer, EGLint elem_size, EGLint size, if (!array) return 0; - count = (size < array->Size) ? size : array->Size; + count = array->Size; if (buffer) { + /* do not exceed buffer size */ + if (count > size) + count = size; for (i = 0; i < count; i++) flatten(array->Elements[i], (void *) ((char *) buffer + elem_size * i));