[PATCH] fix streams where SPS image size changes without refreshing PPS (#299)
authorDirk Farin <dirk.farin@gmail.com>
Tue, 5 Apr 2022 16:41:28 +0000 (18:41 +0200)
committerTobias Frost <tobi@debian.org>
Thu, 15 Dec 2022 16:40:12 +0000 (16:40 +0000)
Gbp-Pq: Name CVE-2021-36408.patch

libde265/decctx.cc

index 62cf20e537ed09e2e529f2496365f8232cdc4416..a962ea126520beafe8c439bb8d3df479a49bb272 100644 (file)
@@ -562,6 +562,15 @@ de265_error decoder_context::read_sps_NAL(bitreader& reader)
 
   sps[ new_sps->seq_parameter_set_id ] = new_sps;
 
+  // Remove the all PPS that referenced the old SPS because parameters may have changed and we do not want to
+  // get the SPS and PPS parameters (e.g. image size) out of sync.
+  
+  for (auto& p : pps) {
+    if (p && p->seq_parameter_set_id == new_sps->seq_parameter_set_id) {
+      p = nullptr;
+    }
+  }
+
   return DE265_OK;
 }