diff mbox

[FFmpeg-devel,PATCHv2,3/3] avfilter/f_setcmd: fix null pointer dereference on using dash as interval

Message ID 20170208232853.16472-1-cus@passwd.hu
State Accepted
Commit a9f3e4b138fc14f7512fde821c051fe1ff7f124f
Headers show

Commit Message

Marton Balint Feb. 8, 2017, 11:28 p.m. UTC
Fixes Coverity CID 1396259.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/f_sendcmd.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Paul B Mahol Feb. 9, 2017, 8:48 a.m. UTC | #1
On 2/9/17, Marton Balint <cus@passwd.hu> wrote:
> Fixes Coverity CID 1396259.
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavfilter/f_sendcmd.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
> index fb30220..522d6ad 100644
> --- a/libavfilter/f_sendcmd.c
> +++ b/libavfilter/f_sendcmd.c
> @@ -268,6 +268,13 @@ static int parse_interval(Interval *interval, int
> interval_count,
>          char *start, *end;
>
>          start = av_strtok(intervalstr, "-", &end);
> +        if (!start) {
> +            ret = AVERROR(EINVAL);
> +            av_log(log_ctx, AV_LOG_ERROR,
> +                   "Invalid interval specification '%s' in interval #%d\n",
> +                   intervalstr, interval_count);
> +            goto end;
> +        }
>          if ((ret = av_parse_time(&interval->start_ts, start, 1)) < 0) {
>              av_log(log_ctx, AV_LOG_ERROR,
>                     "Invalid start time specification '%s' in interval
> #%d\n",
> --
> 2.10.2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

lgtm
Marton Balint Feb. 19, 2017, 3:55 p.m. UTC | #2
On Thu, 9 Feb 2017, Paul B Mahol wrote:

> On 2/9/17, Marton Balint <cus@passwd.hu> wrote:
>> Fixes Coverity CID 1396259.
>>
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>  libavfilter/f_sendcmd.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
>> index fb30220..522d6ad 100644
>> --- a/libavfilter/f_sendcmd.c
>> +++ b/libavfilter/f_sendcmd.c
>> @@ -268,6 +268,13 @@ static int parse_interval(Interval *interval, int
>> interval_count,
>>          char *start, *end;
>>
>>          start = av_strtok(intervalstr, "-", &end);
>> +        if (!start) {
>> +            ret = AVERROR(EINVAL);
>> +            av_log(log_ctx, AV_LOG_ERROR,
>> +                   "Invalid interval specification '%s' in interval #%d\n",
>> +                   intervalstr, interval_count);
>> +            goto end;
>> +        }
>>          if ((ret = av_parse_time(&interval->start_ts, start, 1)) < 0) {
>>              av_log(log_ctx, AV_LOG_ERROR,
>>                     "Invalid start time specification '%s' in interval
>> #%d\n",
>> --
>> 2.10.2
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
> lgtm

Thanks, pushed.

Regards,
Marton
diff mbox

Patch

diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
index fb30220..522d6ad 100644
--- a/libavfilter/f_sendcmd.c
+++ b/libavfilter/f_sendcmd.c
@@ -268,6 +268,13 @@  static int parse_interval(Interval *interval, int interval_count,
         char *start, *end;
 
         start = av_strtok(intervalstr, "-", &end);
+        if (!start) {
+            ret = AVERROR(EINVAL);
+            av_log(log_ctx, AV_LOG_ERROR,
+                   "Invalid interval specification '%s' in interval #%d\n",
+                   intervalstr, interval_count);
+            goto end;
+        }
         if ((ret = av_parse_time(&interval->start_ts, start, 1)) < 0) {
             av_log(log_ctx, AV_LOG_ERROR,
                    "Invalid start time specification '%s' in interval #%d\n",