Mesa (master): egl: Return the correct array size in _eglFlattenArray.
Chia-I Wu
olv at kemper.freedesktop.org
Thu Jul 15 02:06:38 UTC 2010
Module: Mesa
Branch: master
Commit: d7284b45e247d620e3a80bfc9182ff9c45bb7c62
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7284b45e247d620e3a80bfc9182ff9c45bb7c62
Author: Chia-I Wu <olv at lunarg.com>
Date: Thu Jul 15 00:31:39 2010 +0800
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.
---
src/egl/main/eglarray.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/egl/main/eglarray.c b/src/egl/main/eglarray.c
index 781d07f..d686fa1 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));
More information about the mesa-commit
mailing list