* qatar/master: avfiltergraph: check for sws opts being non-NULL before using them. Conflicts: libavfilter/avfiltergraph.c libavfilter/graphparser.c
Showing the changes to libavfilter/avfiltergraph.c (1 of 2 files). Show all
Unified · Split
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <string.h> |
| 24 | 24 | |
| 25 | 25 | #include "libavutil/avassert.h" |
| 26 | +#include "libavutil/avstring.h" | |
| 26 | 27 | #include "libavutil/bprint.h" |
| 27 | 28 | #include "libavutil/channel_layout.h" |
| 28 | 29 | #include "libavutil/opt.h" |
| @@ -340,11 +341,11 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 311 unmodified lines | ||
| 340 | 341 | |
| 341 | 342 | snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d", |
| 342 | 343 | scaler_count++); |
| 343 | − if (graph->scale_sws_opts) | |
| 344 | − snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts); | |
| 345 | − else | |
| 346 | − snprintf(scale_args, sizeof(scale_args), "0:0"); | |
| 347 | − | |
| 344 | + av_strlcpy(scale_args, "0:0", sizeof(scale_args)); | |
| 345 | + if (graph->scale_sws_opts) { | |
| 346 | + av_strlcat(scale_args, ":", sizeof(scale_args)); | |
| 347 | + av_strlcat(scale_args, graph->scale_sws_opts, sizeof(scale_args)); | |
| 348 | + } | |
| 348 | 349 | if ((ret = avfilter_graph_create_filter(&convert, filter, |
| 349 | 350 | inst_name, scale_args, NULL, |
| 350 | 351 | graph)) < 0) |