summaryrefslogtreecommitdiff
path: root/libavcodec/cbs_av1.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2020-06-11 13:06:17 -0300
committerJames Almer <jamrial@gmail.com>2020-06-14 16:42:40 -0300
commit318a1a383dc0312ad5b4afec0ddf0d8d231f5c79 (patch)
treef4950350cca3ec64c99b84b99ad57e2f16e14432 /libavcodec/cbs_av1.c
parentef13fafe229a86480305fbb05e83208102ea962f (diff)
downloadffmpeg-318a1a383dc0312ad5b4afec0ddf0d8d231f5c79.tar.gz
avcodec/cbs_av1: abort when written inferred values don't match
If this happens, it's a sign of parsing issues earlier in the process, or misuse by the calling module. Prevents writing invalid bitstreams. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/cbs_av1.c')
-rw-r--r--libavcodec/cbs_av1.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index fc228086c2..29b316e011 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_INVALIDDATA; \
} \
} while (0)