[FFmpeg-devel] [PATCH 3/3] avcodec/cbs_av1: abort when the written inferred value is not the expected one

Carl Eugen Hoyos ceffmpeg at gmail.com
Sun Jun 14 17:11:30 EEST 2020


Am Do., 11. Juni 2020 um 18:14 Uhr schrieb James Almer <jamrial at gmail.com>:
>
> If this happens, it's a sign of parsing issues earlier in the process, or
> misuse by the calling module.
>
> Prevents creating invalid bitstreams.
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavcodec/cbs_av1.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
> index fc228086c2..456bd9b1d5 100644
> --- a/libavcodec/cbs_av1.c
> +++ b/libavcodec/cbs_av1.c
> @@ -711,10 +711,11 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc)
>
>  #define infer(name, value) do { \
>          if (current->name != (value)) { \
> -            av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \
> +            av_log(ctx->log_ctx, AV_LOG_ERROR, \
>                     "%s does not match inferred value: " \
>                     "%"PRId64", but should be %"PRId64".\n", \
>                     #name, (int64_t)current->name, (int64_t)(value)); \

> +            return AVERROR_BUG; \

For this return value, please explain in the commit message
why this can never happen and in the mail why you are not
using an assert().

Carl Eugen


More information about the ffmpeg-devel mailing list