[FFmpeg-cvslog] avcodec/cbs_h2645: abort when written inferred values don't match

James Almer git at videolan.org
Sun Jun 14 22:46:09 EEST 2020


ffmpeg | branch: release/4.3 | James Almer <jamrial at gmail.com> | Thu Jun 11 13:06:10 2020 -0300| [e6ab99f324b4b2bbb76afc9cd5463ce653ace72e] | committer: James Almer

avcodec/cbs_h2645: 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 at niedermayer.cc>
Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit ef13fafe229a86480305fbb05e83208102ea962f)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e6ab99f324b4b2bbb76afc9cd5463ce653ace72e
---

 libavcodec/cbs_h2645.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index b432921ecc..64fe2c1b9b 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_INVALIDDATA; \
         } \
     } while (0)
 



More information about the ffmpeg-cvslog mailing list