[FFmpeg-devel,1/2] webmdashenc: Require the 'adaptation_sets' option to be ste

Submitted by Derek Buitenhuis on April 20, 2017, 12:14 p.m.

Details

Message ID 1492690483-37511-2-git-send-email-derek.buitenhuis@gmail.com
State New
Headers show

Commit Message

Derek Buitenhuis April 20, 2017, 12:14 p.m.
This seems to be non-optional, and if the muxer is run without it,
strlen() is run on NULL, causing a segfault.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
---
 libavformat/webmdashenc.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Niedermayer April 20, 2017, 3:47 p.m.
On Thu, Apr 20, 2017 at 01:14:42PM +0100, Derek Buitenhuis wrote:
> This seems to be non-optional, and if the muxer is run without it,
> strlen() is run on NULL, causing a segfault.
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
> ---
>  libavformat/webmdashenc.c | 4 ++++
>  1 file changed, 4 insertions(+)

applied

thx

[...]
James Almer April 20, 2017, 3:58 p.m.
On 4/20/2017 9:14 AM, Derek Buitenhuis wrote:
> This seems to be non-optional, and if the muxer is run without it,
> strlen() is run on NULL, causing a segfault.
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
> ---
>   libavformat/webmdashenc.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> index 602726c..2f5c31e 100644
> --- a/libavformat/webmdashenc.c
> +++ b/libavformat/webmdashenc.c
> @@ -433,6 +433,10 @@ static int parse_adaptation_sets(AVFormatContext *s)
>       char *p = w->adaptation_sets;
>       char *q;
>       enum { new_set, parsed_id, parsing_streams } state;
> +    if (!(w->adaptation_sets)) {
> +        av_log(s, AV_LOG_ERROR, "The 'adaptation_sets' option must be set.\n");
> +        return AVERROR_INVALIDDATA;

EINVAL IMO, since it's an user option.

A non-optional user setting that has no default is in any case weird.
Usually, the user expects a ffmpeg -i INPUT OUTPUT to work even if the 
result is of low quality.

> +    }
>       // syntax id=0,streams=0,1,2 id=1,streams=3,4 and so on
>       state = new_set;
>       while (p < w->adaptation_sets + strlen(w->adaptation_sets)) {
>
Michael Niedermayer April 20, 2017, 4:10 p.m.
On Thu, Apr 20, 2017 at 12:58:54PM -0300, James Almer wrote:
> On 4/20/2017 9:14 AM, Derek Buitenhuis wrote:
> >This seems to be non-optional, and if the muxer is run without it,
> >strlen() is run on NULL, causing a segfault.
> >
> >Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
> >---
> >  libavformat/webmdashenc.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> >diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> >index 602726c..2f5c31e 100644
> >--- a/libavformat/webmdashenc.c
> >+++ b/libavformat/webmdashenc.c
> >@@ -433,6 +433,10 @@ static int parse_adaptation_sets(AVFormatContext *s)
> >      char *p = w->adaptation_sets;
> >      char *q;
> >      enum { new_set, parsed_id, parsing_streams } state;
> >+    if (!(w->adaptation_sets)) {
> >+        av_log(s, AV_LOG_ERROR, "The 'adaptation_sets' option must be set.\n");
> >+        return AVERROR_INVALIDDATA;
> 
> EINVAL IMO, since it's an user option.

this applies to both pathes
changed before applying


> 
> A non-optional user setting that has no default is in any case weird.
> Usually, the user expects a ffmpeg -i INPUT OUTPUT to work even if
> the result is of low quality.
> 
> >+    }
> >      // syntax id=0,streams=0,1,2 id=1,streams=3,4 and so on
> >      state = new_set;
> >      while (p < w->adaptation_sets + strlen(w->adaptation_sets)) {
> >
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Derek Buitenhuis April 20, 2017, 4:11 p.m.
On 4/20/2017 4:58 PM, James Almer wrote:
> EINVAL IMO, since it's an user option.

AVERROR_INVALIDDATA was defined as AVERROR(EINVAL) for years, I guess
I forgot it changed to something else...

git blame puts it at 72af5d8a020e4dca1118b3ede67be983b33e27c5 in 2010...
My memory was seriously outdated.

I can change it before push, or however pushes it can change it.

> A non-optional user setting that has no default is in any case weird.
> Usually, the user expects a ffmpeg -i INPUT OUTPUT to work even if the 
> result is of low quality.

I find it odd too, but the entire concept of the webm_dash_manifest "demuxer"
and "muxer" is odd/hacky, so I didn't think about it too much, or I'd have made
myself sad.

- Derek

Patch hide | download patch | download mbox

diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index 602726c..2f5c31e 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -433,6 +433,10 @@  static int parse_adaptation_sets(AVFormatContext *s)
     char *p = w->adaptation_sets;
     char *q;
     enum { new_set, parsed_id, parsing_streams } state;
+    if (!(w->adaptation_sets)) {
+        av_log(s, AV_LOG_ERROR, "The 'adaptation_sets' option must be set.\n");
+        return AVERROR_INVALIDDATA;
+    }
     // syntax id=0,streams=0,1,2 id=1,streams=3,4 and so on
     state = new_set;
     while (p < w->adaptation_sets + strlen(w->adaptation_sets)) {