[FFmpeg-devel] [PATCH 10/17] avcodec/webvttdec: add some memory checks

Clément Bœsch u at pkh.me
Sun Sep 21 19:31:13 CEST 2014


On Sun, Sep 21, 2014 at 07:19:43PM +0200, Nicolas George wrote:
> Le jour de la Récompense, an CCXXII, Clément Bœsch a écrit :
> > So I did that and pushed that part of the patchset, adjusted to use a
> > bprint helper.
> > 
> > Unfortunately, this raises a warning because av_bprint_is_complete()
> > doesn't take a const parameter. I was too lazy to actually fix the API,
> > but didn't want to cast to hide the warning. If you can send a patch to
> > fix the bprint API that would be really appreciated. Thanks :)
> 
> Pushed the attached patch to my tree: Michael can pull if no objection.
> 

Doesn't this need at least a minor bump?

> But you could have not needed it and make the whole set even simpler if you
> had added av_bprint_finalize() to the helper itself.

Not really; in SAMI at least the buffer is allocated only once, and
finalized only at the end. This behaviour could be adopted in other
text subtitles demuxers.

> Even better, "*got_sub = sub->num_rects > 0" could have been factored
> too.

This chunk will change later

> 
> Regards,
> 
> -- 
>   Nicolas George

> From c0394614bacb38a3a303e80b246a76f37a28b391 Mon Sep 17 00:00:00 2001
> From: Nicolas George <george at nsup.org>
> Date: Sun, 21 Sep 2014 19:03:33 +0200
> Subject: [PATCH] lavu/bprint: add const to av_bprint_is_complete() argument.
> 
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>  libavutil/bprint.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavutil/bprint.h b/libavutil/bprint.h
> index 839ec1e..d1682fc 100644
> --- a/libavutil/bprint.h
> +++ b/libavutil/bprint.h
> @@ -179,7 +179,7 @@ void av_bprint_clear(AVBPrint *buf);
>   * It may have been truncated due to a memory allocation failure
>   * or the size_max limit (compare size and size_max if necessary).
>   */
> -static inline int av_bprint_is_complete(AVBPrint *buf)
> +static inline int av_bprint_is_complete(const AVBPrint *buf)
>  {
>      return buf->len < buf->size;
>  }
> -- 
> 2.1.0
> 


-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140921/8fe5ab6a/attachment.asc>


More information about the ffmpeg-devel mailing list