From 7223900b6dcc96cd2debd3951fc450f032da672c Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Fri, 17 Jul 2026 17:04:39 +0800 Subject: [PATCH] fix: initialize EncodingParams enum members format_, video_codec_, audio_codec_, subtitle_sidecar_fmt_ and subtitles_codec_ were left indeterminate by the constructor; reading them before the corresponding Enable* call was UB. Initialize to the kFormatCount/kCodecCount invalid sentinels. --- app/codec/encoder.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/codec/encoder.h b/app/codec/encoder.h index 63f70996e..73e0ead51 100644 --- a/app/codec/encoder.h +++ b/app/codec/encoder.h @@ -268,10 +268,10 @@ private: bool LoadV1(QXmlStreamReader *reader); QString filename_; - ExportFormat::Format format_; + ExportFormat::Format format_ = ExportFormat::kFormatCount; bool video_enabled_; - ExportCodec::Codec video_codec_; + ExportCodec::Codec video_codec_ = ExportCodec::kCodecCount; VideoParams video_params_; QHash video_opts_; int64_t video_bit_rate_; @@ -284,14 +284,14 @@ private: ColorTransform color_transform_; bool audio_enabled_; - ExportCodec::Codec audio_codec_; + ExportCodec::Codec audio_codec_ = ExportCodec::kCodecCount; AudioParams audio_params_; int64_t audio_bit_rate_; bool subtitles_enabled_; bool subtitles_are_sidecar_; - ExportFormat::Format subtitle_sidecar_fmt_; - ExportCodec::Codec subtitles_codec_; + ExportFormat::Format subtitle_sidecar_fmt_ = ExportFormat::kFormatCount; + ExportCodec::Codec subtitles_codec_ = ExportCodec::kCodecCount; rational export_length_; VideoScalingMethod video_scaling_method_;