mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
panvk: Initialize out array with the correct length
This avoids reading past the buffer’s end in the client afterward, because the drmFormatModifierCount hasn’t been changed from what the client passed, if it wasn’t zero at first. GTK triggers that bug by setting it to the length of the static array (see this bug[0] though), but other Vulkan programs might have the same issue if they don’t first query the count before allocating the array. This has been tested on a Radxa ROCK 5B board running a Mali-G610 GPU. [0] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/8222 Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> Fixes:252ddaf51b("panvk: fix VkDrmFormatModifierPropertiesListEXT query") Fixes: https://gitlab.freedesktop.org/mstoeckl/waypipe/-/issues/127 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33657> (cherry picked from commitb4a82110ce)
This commit is contained in:
parent
0ea91330c3
commit
4607eb7eae
2 changed files with 11 additions and 9 deletions
|
|
@ -104,7 +104,7 @@
|
|||
"description": "panvk: Initialize out array with the correct length",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "252ddaf51be72dc84ad1f26311d5403920ff119c",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1243,18 +1243,20 @@ panvk_GetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice,
|
|||
|
||||
VkDrmFormatModifierPropertiesListEXT *list = vk_find_struct(
|
||||
pFormatProperties->pNext, DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT);
|
||||
if (list && pFormatProperties->formatProperties.linearTilingFeatures) {
|
||||
if (list) {
|
||||
VK_OUTARRAY_MAKE_TYPED(VkDrmFormatModifierPropertiesEXT, out,
|
||||
list->pDrmFormatModifierProperties,
|
||||
&list->drmFormatModifierCount);
|
||||
|
||||
vk_outarray_append_typed(VkDrmFormatModifierPropertiesEXT, &out,
|
||||
mod_props)
|
||||
{
|
||||
mod_props->drmFormatModifier = DRM_FORMAT_MOD_LINEAR;
|
||||
mod_props->drmFormatModifierPlaneCount = 1;
|
||||
mod_props->drmFormatModifierTilingFeatures =
|
||||
pFormatProperties->formatProperties.linearTilingFeatures;
|
||||
if (pFormatProperties->formatProperties.linearTilingFeatures) {
|
||||
vk_outarray_append_typed(VkDrmFormatModifierPropertiesEXT, &out,
|
||||
mod_props)
|
||||
{
|
||||
mod_props->drmFormatModifier = DRM_FORMAT_MOD_LINEAR;
|
||||
mod_props->drmFormatModifierPlaneCount = 1;
|
||||
mod_props->drmFormatModifierTilingFeatures =
|
||||
pFormatProperties->formatProperties.linearTilingFeatures;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue