File chromium-133-bring_back_and_disable_allowlist.patch of Package chromium.19172

Index: chromium-141.0.7378.3/media/base/media_switches.h
===================================================================
--- chromium-141.0.7378.3.orig/media/base/media_switches.h
+++ chromium-141.0.7378.3/media/base/media_switches.h
@@ -519,6 +519,8 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(
 
 MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseWindowBoundsForPip);
 
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kFFmpegAllowLists);
+
 MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaLogToConsole);
 
 MEDIA_EXPORT BASE_DECLARE_FEATURE(kLibvpxUseChromeThreads);
Index: chromium-141.0.7378.3/media/base/media_switches.cc
===================================================================
--- chromium-141.0.7378.3.orig/media/base/media_switches.cc
+++ chromium-141.0.7378.3/media/base/media_switches.cc
@@ -1687,6 +1687,11 @@ bool IsRestrictOwnAudioSupported() {
 #endif
 }
 
+// Enables FFmpeg allow lists for supported codecs / containers.
+BASE_FEATURE(kFFmpegAllowLists,
+             "FFmpegAllowLists",
+             base::FEATURE_DISABLED_BY_DEFAULT);
+
 #if BUILDFLAG(IS_WIN)
 bool IsMediaFoundationD3D11VideoCaptureEnabled() {
   return base::FeatureList::IsEnabled(kMediaFoundationD3D11VideoCapture);
Index: chromium-141.0.7378.3/media/ffmpeg/ffmpeg_common.cc
===================================================================
--- chromium-141.0.7378.3.orig/media/ffmpeg/ffmpeg_common.cc
+++ chromium-141.0.7378.3/media/ffmpeg/ffmpeg_common.cc
@@ -16,6 +16,7 @@
 #include "media/base/audio_decoder_config.h"
 #include "media/base/decoder_buffer.h"
 #include "media/base/encryption_scheme.h"
+#include "media/base/media_switches.h"
 #include "media/base/media_util.h"
 #include "media/base/supported_types.h"
 #include "media/base/video_aspect_ratio.h"
@@ -72,7 +73,8 @@ const char* GetAllowedVideoDecoders() {
 void ApplyCodecContextSecuritySettings(AVCodecContext* codec_context) {
   // Future versions of ffmpeg may copy the allow list from the format
   // context.
-  if (!codec_context->codec_whitelist) {
+  if (base::FeatureList::IsEnabled(kFFmpegAllowLists) &&
+      !codec_context->codec_whitelist) {
     // Note: FFmpeg will try to free this string, so we must duplicate it.
     codec_context->codec_whitelist =
         av_strdup(codec_context->codec_type == AVMEDIA_TYPE_AUDIO
Index: chromium-141.0.7378.3/media/filters/ffmpeg_glue.cc
===================================================================
--- chromium-141.0.7378.3.orig/media/filters/ffmpeg_glue.cc
+++ chromium-141.0.7378.3/media/filters/ffmpeg_glue.cc
@@ -137,8 +137,10 @@ FFmpegGlue::FFmpegGlue(FFmpegURLProtocol
   // memory usage.
   //
   // Note: FFmpeg will try to free these strings, so we must duplicate them.
-  format_context_->codec_whitelist = av_strdup(GetAllowedAudioDecoders());
-  format_context_->format_whitelist = av_strdup(GetAllowedDemuxers());
+  if (base::FeatureList::IsEnabled(kFFmpegAllowLists)) {
+    format_context_->codec_whitelist = av_strdup(GetAllowedAudioDecoders());
+    format_context_->format_whitelist = av_strdup(GetAllowedDemuxers());
+  }
 }
 
 bool FFmpegGlue::OpenContext(bool is_local_file) {
openSUSE Build Service is sponsored by