webrtc-check-existence-of-cursor-metadata.patch 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. From c2cd814cdd8cbf8dda6ccec2266327a5321fbde8 Mon Sep 17 00:00:00 2001
  2. From: Jan Grulich <grulja@gmail.com>
  3. Date: Tue, 15 Mar 2022 14:31:55 +0100
  4. Subject: [PATCH] PipeWire capturer: check existence of cursor metadata
  5. Check whether there are any cursor metadata before we try to validate
  6. and use them, otherwise we might crash on this.
  7. Bug: webrtc:13429
  8. Change-Id: I365da59a189b6b974cebafc94fec49d5b942efae
  9. Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/255601
  10. Reviewed-by: Alexander Cooper <alcooper@chromium.org>
  11. Commit-Queue: Alexander Cooper <alcooper@chromium.org>
  12. Cr-Commit-Position: refs/heads/main@{#36240}
  13. ---
  14. .../desktop_capture/linux/wayland/shared_screencast_stream.cc | 2 +-
  15. 1 file changed, 1 insertion(+), 1 deletion(-)
  16. diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
  17. index a8c86e26..9e81df4c 100644
  18. --- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
  19. +++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
  20. @@ -650,7 +650,7 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
  21. const struct spa_meta_cursor* cursor =
  22. static_cast<struct spa_meta_cursor*>(spa_buffer_find_meta_data(
  23. spa_buffer, SPA_META_Cursor, sizeof(*cursor)));
  24. - if (spa_meta_cursor_is_valid(cursor)) {
  25. + if (cursor && spa_meta_cursor_is_valid(cursor)) {
  26. struct spa_meta_bitmap* bitmap = nullptr;
  27. if (cursor->bitmap_offset)