Skip to content

Commit

Permalink
libobs: Fix possible crash with filters
Browse files Browse the repository at this point in the history
This crash happened when a filter was mistakenly used as a regular
source due to an unrelated bug in filter code and scene loading code.
The filter and the source it belongs to both had the same names, and the
source loading code found the filter and mistakenly used it as the
source instead of the actual source with the same name.
  • Loading branch information
jp9000 committed Apr 10, 2016
1 parent cdcb8d1 commit f23974a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions libobs/obs-source.c
Original file line number Diff line number Diff line change
Expand Up @@ -2666,6 +2666,18 @@ void obs_source_process_filter_begin(obs_source_t *filter,

target = obs_filter_get_target(filter);
parent = obs_filter_get_parent(filter);

if (!target) {
blog(LOG_INFO, "filter '%s' being processed with no target!",
filter->context.name);
return;
}
if (!parent) {
blog(LOG_INFO, "filter '%s' being processed with no parent!",
filter->context.name);
return;
}

target_flags = target->info.output_flags;
parent_flags = parent->info.output_flags;
cx = get_base_width(target);
Expand Down Expand Up @@ -2724,6 +2736,10 @@ void obs_source_process_filter_tech_end(obs_source_t *filter, gs_effect_t *effec

target = obs_filter_get_target(filter);
parent = obs_filter_get_parent(filter);

if (!target || !parent)
return;

target_flags = target->info.output_flags;
parent_flags = parent->info.output_flags;

Expand Down

0 comments on commit f23974a

Please sign in to comment.