From 299451ca62865433468c0ba5fa540671a1f9c122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 1 Apr 2026 23:31:36 +0800 Subject: [PATCH] GPU (Linux): ensures we don't pass invalid length to `calloc` Fixes #2259 --- src/detection/gpu/gpu_drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detection/gpu/gpu_drm.c b/src/detection/gpu/gpu_drm.c index 538d23fe4..52f589030 100644 --- a/src/detection/gpu/gpu_drm.c +++ b/src/detection/gpu/gpu_drm.c @@ -181,7 +181,7 @@ const char* ffDrmDetectI915(FFGPUResult* gpu, int fd) { .items_ptr = (uintptr_t) &queryItem, .num_items = 1, }; - if (ioctl(fd, DRM_IOCTL_I915_QUERY, &query) >= 0) { + if (ioctl(fd, DRM_IOCTL_I915_QUERY, &query) >= 0 && queryItem.length > 0) { // #2259 FF_AUTO_FREE uint8_t* buffer = calloc(1, (size_t) queryItem.length); queryItem.data_ptr = (uintptr_t) buffer; if (ioctl(fd, DRM_IOCTL_I915_QUERY, &query) >= 0) {