[FFmpeg-devel] [PATCH 07/12] cngenc: Add missing error check

Rostislav Pehlivanov atomnuker at gmail.com
Fri Jul 7 00:07:37 EEST 2017


On 6 July 2017 at 19:28, Derek Buitenhuis <derek.buitenhuis at gmail.com>
wrote:

> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  libavcodec/cngenc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/cngenc.c b/libavcodec/cngenc.c
> index 302c703f72..b7207fd5f6 100644
> --- a/libavcodec/cngenc.c
> +++ b/libavcodec/cngenc.c
> @@ -92,6 +92,8 @@ static int cng_encode_frame(AVCodecContext *avctx,
> AVPacket *avpkt,
>          qdbov = 127;
>      }
>      ret = ff_lpc_calc_ref_coefs(&p->lpc, p->samples32, p->order,
> p->ref_coef);
> +    if (ret < 0)
> +        return ret;
>      avpkt->data[0] = qdbov;
>      for (i = 0; i < p->order; i++)
>          avpkt->data[1 + i] = p->ref_coef[i] * 127 + 127;
> --
> 2.11.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Just remove setting and checking the return value altogether,
ff_lpc_calc_ref_coeffs returns the order which you give it and can't error
out. Would look good to me if you did that, so feel free to push once done.


More information about the ffmpeg-devel mailing list