avisynth: Validate downmix option

Because... let's maybe not let users make Aegisub call arbitrary
symbols in avisynth.dll/so just by editing the config.json.
This commit is contained in:
arch1t3cht 2022-08-09 02:43:43 +02:00
parent fe285678a3
commit ce1b3a0158
1 changed files with 3 additions and 2 deletions

View File

@ -113,8 +113,9 @@ void AvisynthAudioProvider::LoadFromClip(AVSValue clip) {
AVSValue script;
// Convert to one channel
if (OPT_GET("Audio/Downmixer")->GetString() != "None")
script = env->Invoke(OPT_GET("Audio/Downmixer")->GetString().c_str(), clip);
std::string downmixtype = OPT_GET("Audio/Downmixer")->GetString();
if (downmixtype == "ConvertToMono" || downmixtype == "GetLeftChannel" || downmixtype == "GetRightChannel")
script = env->Invoke(downmixtype.c_str(), clip);
else
script = clip;