mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
vulkanoverlaycompositor: don't do a potential use after free
Removing a meta from a buffer means one doesn't have access to it anymore. Instead use the already reffed composition directly. Fixes a use-after-free in the following pipeline: ... ! vulkanupload ! timeoverlay ! vulkanoverlaycompositor ! ... Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4143>
This commit is contained in:
parent
df939fe332
commit
a1bfd8668c
1 changed files with 2 additions and 1 deletions
|
@ -729,6 +729,7 @@ gst_vulkan_overlay_compositor_transform_ip (GstBaseTransform * bt,
|
||||||
|
|
||||||
comp = gst_video_overlay_composition_ref (ometa->overlay);
|
comp = gst_video_overlay_composition_ref (ometa->overlay);
|
||||||
gst_buffer_remove_meta (buffer, (GstMeta *) ometa);
|
gst_buffer_remove_meta (buffer, (GstMeta *) ometa);
|
||||||
|
ometa = NULL;
|
||||||
|
|
||||||
n = gst_video_overlay_composition_n_rectangles (comp);
|
n = gst_video_overlay_composition_n_rectangles (comp);
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
|
@ -765,7 +766,7 @@ gst_vulkan_overlay_compositor_transform_ip (GstBaseTransform * bt,
|
||||||
struct vk_overlay *over =
|
struct vk_overlay *over =
|
||||||
&g_array_index (vk_overlay->overlays, struct vk_overlay, i);
|
&g_array_index (vk_overlay->overlays, struct vk_overlay, i);
|
||||||
|
|
||||||
if (!overlay_in_rectangles (over, ometa->overlay)) {
|
if (!overlay_in_rectangles (over, comp)) {
|
||||||
g_array_remove_index (vk_overlay->overlays, i);
|
g_array_remove_index (vk_overlay->overlays, i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue