[client] egl: fix undefined behaviour with zero size array

This commit is contained in:
Geoffrey McRae 2021-10-20 13:34:16 +11:00
parent c5f71d18c4
commit dca5da02a0
2 changed files with 9 additions and 0 deletions

View File

@ -107,6 +107,12 @@ inline static void rectToVertices(GLfloat * vertex, const FrameDamageRect * rect
void egl_desktopRectsUpdate(EGL_DesktopRects * rects, const struct DamageRects * data,
int width, int height)
{
if (data && data->count == 0)
{
rects->count = 0;
return;
}
GLfloat vertices[(!data || data->count < 0 ? 1 : data->count) * 8];
if (!data || data->count < 0)
{

View File

@ -211,6 +211,9 @@ inline static bool rectIntersects(const FrameDamageRect * r1, const FrameDamageR
int rectsMergeOverlapping(FrameDamageRect * rects, int count)
{
if (count == 0)
return 0;
bool removed[count];
bool changed;