[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>
Tue, 24 Jan 2023 21:39:16 +0000 (21:39 +0000)
Gbp-Pq: Name CVE-2021-36408.patch

libde265/decctx.cc

index edebb71362777cfc5041b9bbdc7ea28f89b05940..6701725fbe0c6cecdbdd1d1cff1b514a45fb69a1 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;
 }