mirror of
https://github.com/X11Libre/xf86-video-amdgpu.git
synced 2026-03-24 01:24:31 +00:00
fix a double free caused by amdgpu_dri3_get_formats()
The function now allocates memory with malloc() and copies the formats array, instead of returning a pointer to static memory that the xserver would try to free() later.
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
# Initialize Autoconf
|
# Initialize Autoconf
|
||||||
AC_PREREQ([2.60])
|
AC_PREREQ([2.60])
|
||||||
AC_INIT([xlibre-xf86-video-amdgpu],
|
AC_INIT([xlibre-xf86-video-amdgpu],
|
||||||
[25.1.0],
|
[25.1.1],
|
||||||
[https://github.com/X11Libre/xf86-video-amdgpu/issues],
|
[https://github.com/X11Libre/xf86-video-amdgpu/issues],
|
||||||
[xlibre-xf86-video-amdgpu])
|
[xlibre-xf86-video-amdgpu])
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
project(
|
project(
|
||||||
'xf86-video-amdgpu',
|
'xf86-video-amdgpu',
|
||||||
'c',
|
'c',
|
||||||
version: '25.1.0',
|
version: '25.1.1',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
meson_version: '>=0.59.0',
|
meson_version: '>=0.59.0',
|
||||||
default_options: ['warning_level=1']
|
default_options: ['warning_level=1']
|
||||||
|
|||||||
@@ -829,10 +829,15 @@ amdgpu_dri3_get_formats(ScreenPtr screen, unsigned int *num_formats,
|
|||||||
DRM_FORMAT_RGB332,
|
DRM_FORMAT_RGB332,
|
||||||
DRM_FORMAT_BGR233,
|
DRM_FORMAT_BGR233,
|
||||||
};
|
};
|
||||||
|
unsigned int count = sizeof(formats_arr) / sizeof(formats_arr[0]);
|
||||||
|
|
||||||
*num_formats = sizeof(formats_arr) / sizeof(formats_arr[0]);
|
*formats = malloc(count * sizeof(uint32_t));
|
||||||
*formats = (unsigned int *)formats_arr;
|
if (!*formats)
|
||||||
return sizeof(formats_arr) / sizeof(formats_arr[0]);
|
return 0;
|
||||||
|
|
||||||
|
memcpy(*formats, formats_arr, count * sizeof(uint32_t));
|
||||||
|
*num_formats = count;
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user