Skip to content

Commit

Permalink
Correct read past end of list error in format enumeration
Browse files Browse the repository at this point in the history
When format lists are split across mutliple caps structures,
each list should be read up to its size, not the aggregate of
all formats.
  • Loading branch information
dhobsong committed Apr 4, 2019
1 parent 8f7cb67 commit 13094e8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/libv4l-gst/gst-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,15 +517,17 @@ get_supported_video_format_cap(GstElement *appsink, struct fmts **cap_fmts,
fmts_num = 0;

for (j = 0; j < structs; j++) {
gint num_cap_formats;
structure = gst_caps_get_structure(caps, j);
val = gst_structure_get_value(structure, "format");
if (!val)
continue;

list_size += gst_value_list_get_size(val);
num_cap_formats = gst_value_list_get_size(val);
list_size += num_cap_formats;
color_fmts = g_renew(struct fmts, color_fmts, list_size);

for (i = 0; i < list_size; i++) {
for (i = 0; i < num_cap_formats; i++) {
list_val = gst_value_list_get_value(val, i);
fmt_str = g_value_get_string(list_val);

Expand Down

0 comments on commit 13094e8

Please sign in to comment.