[FFmpeg-devel] [PATCH] avfilter/f_metadata: use AVBPrint API to remove buf size limitation
Nicolas George
george at nsup.org
Mon Jun 8 17:02:22 EEST 2020
lance.lmwang at gmail.com (12020-06-08):
> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
> libavfilter/f_metadata.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
> index 598257b15b..808782d31a 100644
> --- a/libavfilter/f_metadata.c
> +++ b/libavfilter/f_metadata.c
> @@ -31,6 +31,7 @@
> #include "libavutil/internal.h"
> #include "libavutil/opt.h"
> #include "libavutil/timestamp.h"
> +#include "libavutil/bprint.h"
> #include "libavformat/avio.h"
> #include "avfilter.h"
> #include "audio.h"
> @@ -195,9 +196,11 @@ static void print_file(AVFilterContext *ctx, const char *msg, ...)
>
> va_start(argument_list, msg);
> if (msg) {
> - char buf[128];
> - vsnprintf(buf, sizeof(buf), msg, argument_list);
> - avio_write(s->avio_context, buf, av_strnlen(buf, sizeof(buf)));
> + AVBPrint buf;
> + av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
> + av_vbprintf(&buf, msg, argument_list);
> + avio_write(s->avio_context, buf.str, buf.len);
Error check missing.
> + av_bprint_finalize(&buf, NULL);
> }
> va_end(argument_list);
> }
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200608/07c144db/attachment.sig>
More information about the ffmpeg-devel
mailing list