mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
lavfi/sendcmd: improve error reporting and robustness in case of missing commands
In particular, fix crash with -vf sendcmd, when no arguments are provided.
This commit is contained in:
parent
e8374d7202
commit
83ee820a16
@ -318,6 +318,9 @@ static int parse_intervals(Interval **intervals, int *nb_intervals,
|
||||
*intervals = NULL;
|
||||
*nb_intervals = 0;
|
||||
|
||||
if (!buf)
|
||||
return 0;
|
||||
|
||||
while (1) {
|
||||
Interval interval;
|
||||
|
||||
@ -373,9 +376,9 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
SendCmdContext *sendcmd = ctx->priv;
|
||||
int ret, i, j;
|
||||
|
||||
if (sendcmd->commands_filename && sendcmd->commands_str) {
|
||||
if ((!!sendcmd->commands_filename + !!sendcmd->commands_str) != 1) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"Only one of the filename or commands options must be specified\n");
|
||||
"One and only one of the filename or commands options must be specified\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
@ -404,7 +407,7 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
return ret;
|
||||
|
||||
if (sendcmd->nb_intervals == 0) {
|
||||
av_log(ctx, AV_LOG_ERROR, "No commands\n");
|
||||
av_log(ctx, AV_LOG_ERROR, "No commands were specified\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user