Skip to content

Commit 299451c

Browse files
committed
GPU (Linux): ensures we don't pass invalid length to calloc
Fixes #2259
1 parent 6319b68 commit 299451c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/detection/gpu/gpu_drm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const char* ffDrmDetectI915(FFGPUResult* gpu, int fd) {
181181
.items_ptr = (uintptr_t) &queryItem,
182182
.num_items = 1,
183183
};
184-
if (ioctl(fd, DRM_IOCTL_I915_QUERY, &query) >= 0) {
184+
if (ioctl(fd, DRM_IOCTL_I915_QUERY, &query) >= 0 && queryItem.length > 0) { // #2259
185185
FF_AUTO_FREE uint8_t* buffer = calloc(1, (size_t) queryItem.length);
186186
queryItem.data_ptr = (uintptr_t) buffer;
187187
if (ioctl(fd, DRM_IOCTL_I915_QUERY, &query) >= 0) {

0 commit comments

Comments
 (0)