From e86108014570d9864dfd3e92dab031bc4a70f096 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 19 Jul 2022 23:55:42 +0900 Subject: [PATCH] internal/graphicsdriver/directx: early error check for Wine Updates #2114 --- internal/graphicsdriver/directx/graphics_windows.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/graphicsdriver/directx/graphics_windows.go b/internal/graphicsdriver/directx/graphics_windows.go index 644fea61b..f62578c90 100644 --- a/internal/graphicsdriver/directx/graphics_windows.go +++ b/internal/graphicsdriver/directx/graphics_windows.go @@ -1047,6 +1047,9 @@ func (g *Graphics) NewImage(width, height int) (graphicsdriver.Image, error) { } layouts, _, _, totalBytes := g.device.GetCopyableFootprints(&desc, 0, 1, 0) + if totalBytes == 1<<64-1 { + return nil, fmt.Errorf("directx: GetCopyableFootprints returned an invalid total bytes") + } i := &Image{ graphics: g,