[client] egl: fix buffer overflow in desktop_rects module

The module has been changed to support variable amount of rectangles,
so we should just allocate a VLA.
This commit is contained in:
Quantum 2021-08-11 07:19:02 -04:00 committed by Geoffrey McRae
parent 543c97987b
commit 3f8c7c8d0d

View File

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