[FFmpeg-devel] [PATCH] avcodec/tak_parser: don't return error values

Michael Niedermayer michael at niedermayer.cc
Fri Jul 19 01:10:25 EEST 2019


On Wed, Jul 17, 2019 at 07:38:50PM -0300, James Almer wrote:
> The API does not allow it.
> 
> Also set poutbuf and poutbuf_size to NULL/0 on error to avoid leaving
> them uninitialized.
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavcodec/tak_parser.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/tak_parser.c b/libavcodec/tak_parser.c
> index 835a47bd52..7943d2ed3a 100644
> --- a/libavcodec/tak_parser.c
> +++ b/libavcodec/tak_parser.c
> @@ -49,7 +49,7 @@ static int tak_parse(AVCodecParserContext *s, AVCodecContext *avctx,
>      if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
>          TAKStreamInfo ti;
>          if ((ret = init_get_bits8(&gb, buf, buf_size)) < 0)
> -            return ret;
> +            goto fail;
>          if (!ff_tak_decode_frame_header(avctx, &gb, &ti, 127))
>              s->duration = t->ti.last_frame_samples ? t->ti.last_frame_samples
>                                                     : t->ti.frame_samples;

this would occur if buf_size is too big ( >250mb )

[...]
> +fail:
> +
> +    *poutbuf      = NULL;
> +    *poutbuf_size = 0;
> +    return buf_size + consumed;

and this would silently drop the data

i think thats not ideal, it would be better to pass through packets
which exceed the capabilities of the parser

Thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190719/37cf9871/attachment.sig>


More information about the ffmpeg-devel mailing list