Skip to content

Commit 5d04d51

Browse files
pobrnRytoEX
authored andcommitted
linux-pipewire: Fix uninitialized camera resolution access
The use of `SPA_POD_OPT_Rectangle()` means that if the rectangle cannot be parsed, then no error will be returned. In that case uninitialized variables will be used. This can happen if the pod object contains e.g. a list of resolutions (`SPA_CHOICE_Enum`). Fix that by using `SPA_POD_Rectangle()`, which enforces successful parsing.
1 parent b7bc979 commit 5d04d51

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugins/linux-pipewire/camera-portal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ static void camera_format_list(struct camera_device *dev, obs_property_t *prop)
366366
}
367367

368368
if (spa_pod_parse_object(p->param, SPA_TYPE_OBJECT_Format, format ? &format : NULL,
369-
SPA_FORMAT_VIDEO_size, SPA_POD_OPT_Rectangle(&resolution)) < 0)
369+
SPA_FORMAT_VIDEO_size, SPA_POD_Rectangle(&resolution)) < 0)
370370
continue;
371371

372372
obs_data_set_int(data, "width", resolution.width);
@@ -677,7 +677,7 @@ static bool framerate_list(struct camera_device *dev, uint32_t pixelformat, cons
677677
continue;
678678

679679
if (spa_pod_parse_object(p->param, SPA_TYPE_OBJECT_Format, NULL, SPA_FORMAT_VIDEO_size,
680-
SPA_POD_OPT_Rectangle(&this_resolution)) < 0)
680+
SPA_POD_Rectangle(&this_resolution)) < 0)
681681
continue;
682682

683683
if (this_resolution.width != resolution->width || this_resolution.height != resolution->height)

0 commit comments

Comments
 (0)