summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-07-15 00:31:39 +0800
committerChia-I Wu <olv@lunarg.com>2010-07-15 10:05:46 +0800
commitd7284b45e247d620e3a80bfc9182ff9c45bb7c62 (patch)
tree39b30bd399bc6f0d0294cce6e7aa50ca957f3ea6
parent2f4ce2564577755aaf58d05dec3a66d9982e56e1 (diff)
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.
-rw-r--r--src/egl/main/eglarray.c5
1 files changed, 4 insertions, 1 deletions
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));