[FFmpeg-devel] [PATCH v1 3/5] avfilter/vf_showinfo: display user data unregistered message

Limin Wang lance.lmwang at gmail.com
Wed Dec 18 02:48:25 EET 2019


On Tue, Dec 17, 2019 at 06:18:55PM -0300, James Almer wrote:
> On 12/17/2019 7:22 AM, lance.lmwang at gmail.com wrote:
> > From: Limin Wang <lance.lmwang at gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> > ---
> >  libavfilter/vf_showinfo.c | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> > 
> > diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> > index 31f6b32aa4..0d227983c2 100644
> > --- a/libavfilter/vf_showinfo.c
> > +++ b/libavfilter/vf_showinfo.c
> > @@ -169,6 +169,23 @@ static void dump_content_light_metadata(AVFilterContext *ctx, AVFrameSideData *s
> >             metadata->MaxCLL, metadata->MaxFALL);
> >  }
> >  
> > +static void dump_user_data_unregistered_metadata(AVFilterContext *ctx, AVFrameSideData *sd)
> > +{
> > +    const int uuid_size = 16;
> > +
> > +    if (sd->size < uuid_size) {
> > +        av_log(ctx, AV_LOG_ERROR, "invalid data");
> > +        return;
> > +    }
> > +
> > +    av_log(ctx, AV_LOG_INFO, "User data unregistered:\n");
> > +    av_log(ctx, AV_LOG_INFO, "UUID=");
> > +    for (int i = 0; i < uuid_size; i++)
> > +        av_log(ctx, AV_LOG_INFO, "%x", sd->data[i]);
> > +    av_log(ctx, AV_LOG_INFO, "\n");
> > +    av_log(ctx, AV_LOG_INFO, "User Data=%s", sd->data + uuid_size);
> 
> I recall we used to print any user unregistered data SEI in debug mode
> but eventually stopped since it presented a risk. We can't just blindly
> print whatever is contained here. It should at least be checked that
> it's actually printable characters and not random binary data.

yes, I'll add safe check for string is ascii or not.

> 
> > +}
> > +
> >  static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
> >  {
> >      const char *color_range_str     = av_color_range_name(frame->color_range);
> > @@ -319,6 +336,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> >              av_log(ctx, AV_LOG_INFO, "GOP timecode - %s", tcbuf);
> >              break;
> >          }
> > +        case AV_FRAME_DATA_USER_DATA_UNREGISTERED:
> > +            dump_user_data_unregistered_metadata(ctx, sd);
> > +            break;
> >          default:
> >              av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)",
> >                     sd->type, sd->size);
> > 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list