Message ID | 20190514041517.14116-1-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Commit | 670251de56cdcda0c32d588959c8ed2da09075a2 |
Headers | show |
On 14-05-2019 09:45 AM, Andreas Rheinhardt wrote: > b3b7ba62 introduced undefined behaviour: A (non-modifiable) string > literal has been assigned to a modifiable string; said string was indeed > modified later via av_strtok. > This of course caused compiler warnings because of the discarded > qualifier; these are in particular fixed by this commit. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- > libavfilter/vf_stack.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c > index 1455f196a7..4d254e0013 100644 > --- a/libavfilter/vf_stack.c > +++ b/libavfilter/vf_stack.c > @@ -84,9 +84,11 @@ static av_cold int init(AVFilterContext *ctx) > > if (!strcmp(ctx->filter->name, "xstack")) { > if (!s->layout) { > - if (s->nb_inputs == 2) > - s->layout = "0_0|w0_0"; > - else { > + if (s->nb_inputs == 2) { > + s->layout = av_strdup("0_0|w0_0"); > + if (!s->layout) > + return AVERROR(ENOMEM); > + } else { > av_log(ctx, AV_LOG_ERROR, "No layout specified.\n"); > return AVERROR(EINVAL); > } Sorry, I missed what was being done with the string later on. Gyan
On 5/14/19, Gyan <ffmpeg@gyani.pro> wrote: > > > On 14-05-2019 09:45 AM, Andreas Rheinhardt wrote: >> b3b7ba62 introduced undefined behaviour: A (non-modifiable) string >> literal has been assigned to a modifiable string; said string was indeed >> modified later via av_strtok. >> This of course caused compiler warnings because of the discarded >> qualifier; these are in particular fixed by this commit. >> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> >> --- >> libavfilter/vf_stack.c | 8 +++++--- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c >> index 1455f196a7..4d254e0013 100644 >> --- a/libavfilter/vf_stack.c >> +++ b/libavfilter/vf_stack.c >> @@ -84,9 +84,11 @@ static av_cold int init(AVFilterContext *ctx) >> >> if (!strcmp(ctx->filter->name, "xstack")) { >> if (!s->layout) { >> - if (s->nb_inputs == 2) >> - s->layout = "0_0|w0_0"; >> - else { >> + if (s->nb_inputs == 2) { >> + s->layout = av_strdup("0_0|w0_0"); >> + if (!s->layout) >> + return AVERROR(ENOMEM); >> + } else { >> av_log(ctx, AV_LOG_ERROR, "No layout specified.\n"); >> return AVERROR(EINVAL); >> } > > Sorry, I missed what was being done with the string later on. > Why you pushed something else that what was reviewed? > Gyan > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
On 5/14/19, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote: > b3b7ba62 introduced undefined behaviour: A (non-modifiable) string > literal has been assigned to a modifiable string; said string was indeed > modified later via av_strtok. > This of course caused compiler warnings because of the discarded > qualifier; these are in particular fixed by this commit. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- > libavfilter/vf_stack.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c > index 1455f196a7..4d254e0013 100644 > --- a/libavfilter/vf_stack.c > +++ b/libavfilter/vf_stack.c > @@ -84,9 +84,11 @@ static av_cold int init(AVFilterContext *ctx) > > if (!strcmp(ctx->filter->name, "xstack")) { > if (!s->layout) { > - if (s->nb_inputs == 2) > - s->layout = "0_0|w0_0"; > - else { > + if (s->nb_inputs == 2) { > + s->layout = av_strdup("0_0|w0_0"); > + if (!s->layout) > + return AVERROR(ENOMEM); > + } else { > av_log(ctx, AV_LOG_ERROR, "No layout specified.\n"); > return AVERROR(EINVAL); > } > -- > 2.21.0 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". Applied.
On 14-05-2019 06:11 PM, Paul B Mahol wrote: > On 5/14/19, Gyan <ffmpeg@gyani.pro> wrote: >> >> On 14-05-2019 09:45 AM, Andreas Rheinhardt wrote: >>> b3b7ba62 introduced undefined behaviour: A (non-modifiable) string >>> literal has been assigned to a modifiable string; said string was indeed >>> modified later via av_strtok. >>> This of course caused compiler warnings because of the discarded >>> qualifier; these are in particular fixed by this commit. >>> >>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> >>> --- >>> libavfilter/vf_stack.c | 8 +++++--- >>> 1 file changed, 5 insertions(+), 3 deletions(-) >>> >>> diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c >>> index 1455f196a7..4d254e0013 100644 >>> --- a/libavfilter/vf_stack.c >>> +++ b/libavfilter/vf_stack.c >>> @@ -84,9 +84,11 @@ static av_cold int init(AVFilterContext *ctx) >>> >>> if (!strcmp(ctx->filter->name, "xstack")) { >>> if (!s->layout) { >>> - if (s->nb_inputs == 2) >>> - s->layout = "0_0|w0_0"; >>> - else { >>> + if (s->nb_inputs == 2) { >>> + s->layout = av_strdup("0_0|w0_0"); >>> + if (!s->layout) >>> + return AVERROR(ENOMEM); >>> + } else { >>> av_log(ctx, AV_LOG_ERROR, "No layout specified.\n"); >>> return AVERROR(EINVAL); >>> } >> Sorry, I missed what was being done with the string later on. >> > Why you pushed something else that what was reviewed? The code I pushed was exactly the same as what you reviewed; only the commit msg was changed to what you suggested. See http://www.ffmpeg.org/pipermail/ffmpeg-devel/2019-May/243664.html vs http://git.videolan.org/?p=ffmpeg.git;a=blobdiff;f=libavfilter/vf_stack.c;h=1455f196a7cb3124f7a7931f6b56ed985848d75b;hp=b836d96bf09a70d943f28b4424da0af3bf62ecea;hb=b3b7ba623f95224557bd67a060adf4ca7ee94dde;hpb=e25bddf5fce88f95be8bf3cbc8adf4a74bc28fb5 Your review: http://www.ffmpeg.org/pipermail/ffmpeg-devel/2019-May/243665.html Gyan
diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c index 1455f196a7..4d254e0013 100644 --- a/libavfilter/vf_stack.c +++ b/libavfilter/vf_stack.c @@ -84,9 +84,11 @@ static av_cold int init(AVFilterContext *ctx) if (!strcmp(ctx->filter->name, "xstack")) { if (!s->layout) { - if (s->nb_inputs == 2) - s->layout = "0_0|w0_0"; - else { + if (s->nb_inputs == 2) { + s->layout = av_strdup("0_0|w0_0"); + if (!s->layout) + return AVERROR(ENOMEM); + } else { av_log(ctx, AV_LOG_ERROR, "No layout specified.\n"); return AVERROR(EINVAL); }
b3b7ba62 introduced undefined behaviour: A (non-modifiable) string literal has been assigned to a modifiable string; said string was indeed modified later via av_strtok. This of course caused compiler warnings because of the discarded qualifier; these are in particular fixed by this commit. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavfilter/vf_stack.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)