diff mbox series

[FFmpeg-devel,2/3] avcodec/cbs_h2645: abort when the written inferred value is not the expected one

Message ID 20200611161320.5136-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/cbs_h2645: keep separate parameter set lists for reading and writing | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

James Almer June 11, 2020, 4:13 p.m. UTC
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@gmail.com>
---
 libavcodec/cbs_h2645.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 69ed890c63..f239d52271 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -408,10 +408,11 @@  static int cbs_h2645_read_more_rbsp_data(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; \
         } \
     } while (0)