[PATCH] initialize newly created CABAC model table when (fixes #236)
authorDirk Farin <dirk.farin@gmail.com>
Tue, 24 Jan 2023 18:01:42 +0000 (19:01 +0100)
committerTobias Frost <tobi@debian.org>
Tue, 24 Jan 2023 21:39:16 +0000 (21:39 +0000)
Gbp-Pq: Name CVE-2020-21596-global-buffer-overflow.patch

libde265/contextmodel.cc

index ec432281d0dadaa9ec80353748f3eff2a0b1fb3a..7244471f9270a1dbe1c20b0325b7551b89522518 100644 (file)
@@ -181,6 +181,8 @@ void context_model_table::decouple_or_alloc_with_empty_data()
   if (D) printf("%p (alloc)\n",this);
 
   model = new context_model[CONTEXT_MODEL_TABLE_LENGTH];
+  // Without initializing the model, we got an invalid model state during decoding (issue #236)
+  memset(model, 0, sizeof(context_model) * CONTEXT_MODEL_TABLE_LENGTH);
   refcnt= new int;
   *refcnt=1;
 }