From ca03802a456e7cf4efd834edfeddc483ac72e4b5 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 29 Apr 2021 19:06:05 +0200 Subject: [PATCH] wined3d: Only read "*rect_count" when "rects" is non-NULL in wined3d_device_context_get_scissor_rects() (Valgrind). When "rects" is NULL, "*rect_count" is potentially uninitialised. That's fairly benign because the resulting "count" value is inconsequential in that case, but it's also unnecessary, and easy to avoid. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/device.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f3d7cff74bf..813ee773478 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1722,8 +1722,7 @@ void CDECL wined3d_device_context_get_scissor_rects(const struct wined3d_device_ TRACE("context %p, rect_count %p, rects %p.\n", context, rect_count, rects); - count = rect_count ? min(*rect_count, state->scissor_rect_count) : 1; - if (count && rects) + if (rects && (count = rect_count ? min(*rect_count, state->scissor_rect_count) : 1)) memcpy(rects, state->scissor_rects, count * sizeof(*rects)); if (rect_count) *rect_count = state->scissor_rect_count;