PipeWire capturer: check existence of cursor metadata

Check whether there are any cursor metadata before we try to validate
and use them, otherwise we might crash on this.

Bug: webrtc:13429
Change-Id: I365da59a189b6b974cebafc94fec49d5b942efae
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/255601
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#36240}
This commit is contained in:
Jan Grulich 2022-03-15 14:31:55 +01:00 committed by WebRTC LUCI CQ
parent 7fa9057a05
commit c2cd814cdd

View File

@ -650,7 +650,7 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
const struct spa_meta_cursor* cursor =
static_cast<struct spa_meta_cursor*>(spa_buffer_find_meta_data(
spa_buffer, SPA_META_Cursor, sizeof(*cursor)));
if (spa_meta_cursor_is_valid(cursor)) {
if (cursor && spa_meta_cursor_is_valid(cursor)) {
struct spa_meta_bitmap* bitmap = nullptr;
if (cursor->bitmap_offset)