On Mon, Feb 01, 2021 at 11:56:25AM +0100, Tomas Härdin wrote: > mån 2021-02-01 klockan 07:50 +0800 skrev lance.lmw...@gmail.com: > > From: Limin Wang <lance.lmw...@gmail.com> > > > > Please check the string of toolkit version with below command: > > ./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy out.mxf > > ./ffmpeg -i out.mxf > > .... > > toolkit_version : 58.65.101 > > > > Signed-off-by: Limin Wang <lance.lmw...@gmail.com> > > --- > > libavformat/mxfdec.c | 25 +++++++++++++++++++++++++ > > tests/ref/fate/mxf-probe-applehdr10 | 1 + > > tests/ref/fate/mxf-probe-dnxhd | 1 + > > 3 files changed, 27 insertions(+) > > > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > > index afff204..61c8104 100644 > > --- a/libavformat/mxfdec.c > > +++ b/libavformat/mxfdec.c > > @@ -1970,6 +1970,18 @@ static int mxf_umid_to_str(UID ul, UID uid, char > > **str) > > return 0; > > } > > > > +static int mxf_version_to_str(uint16_t major, uint16_t minor, uint16_t > > tertiary, char **str) > > +{ > > + int size = sizeof(major) * 5 + 1; > > This is just wrong. Should be 3*5+2+1 = 18.
will fix it. > > > + > > + *str = av_mallocz(size); > > + if (!*str) > > + return AVERROR(ENOMEM); > > + > > + snprintf(*str, size, "%d.%d.%d", major, minor, tertiary); > > snprintf() is not safe - *str can end up not NUL terminated what's your suggestion? I think allocate *str with +1 byte and zero it to sure the string will be NULL terminated. > > > +#define SET_VERSION_METADATA(pb, name, major, minor, tertiary, str) do { \ > > + major = avio_rb16(pb); \ > > + minor = avio_rb16(pb); \ > > + tertiary = avio_rb16(pb); \ > > + if ((ret = mxf_version_to_str(major, minor, tertiary, &str)) < 0) \ > > + return ret; \ > > + av_dict_set(&s->metadata, name, str, AV_DICT_DONT_STRDUP_VAL); \ > > +} while (0) > > Why not a function? Function is OK to me, I'm just following the same style for SET_STR_METADATA, SET_UID_METADATA, SET_TS_METADATA. > > /Tomas > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". -- Thanks, Limin Wang _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".