summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/egl/main/eglarray.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/egl/main/eglarray.c b/src/egl/main/eglarray.c
index 3ccc8a649f0..d2f39af49a6 100644
--- a/src/egl/main/eglarray.c
+++ b/src/egl/main/eglarray.c
@@ -197,6 +197,9 @@ _eglFlattenArray(_EGLArray *array, void *buffer, EGLint elem_size, EGLint size,
count = array->Size;
if (buffer) {
+ /* clamp size to 0 */
+ if (size < 0)
+ size = 0;
/* do not exceed buffer size */
if (count > size)
count = size;