[FFmpeg-devel] [PATCH] avcodec/h264_parse: Treat escaped and unescaped decoding error equal in decode_extradata_ps_mp4()

Clément Bœsch u at pkh.me
Sun Nov 26 00:08:46 EET 2017


On Sat, Nov 25, 2017 at 10:49:09PM +0100, Michael Niedermayer wrote:
> Fixes: lorex.mp4
> 
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavcodec/h264_parse.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
> index a7c71d9bbb..9216d0bdbd 100644
> --- a/libavcodec/h264_parse.c
> +++ b/libavcodec/h264_parse.c
> @@ -427,8 +427,6 @@ static int decode_extradata_ps_mp4(const uint8_t *buf, int buf_size, H264ParamSe
>  
>          ret = decode_extradata_ps(escaped_buf, escaped_buf_size, ps, 1, logctx);
>          av_freep(&escaped_buf);
> -        if (ret < 0)
> -            return ret;

If you don't want the return code to be reintroduced differently 10x in
the future (like, someone deciding to return ret in the function instead
of 0), I'd suggest 2 things:

- use "(void)decode_extradata_ps(...)" to explicitly ignore the code
  return; it's a hint for the compiler and the developer, typically used
  in OpenBSD (I believe that's because they warn about unchecked return
  code by default)
- add a comment above about the why

No comment on the change itself.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171125/fb5ee5f1/attachment.sig>


More information about the ffmpeg-devel mailing list