diff options
Diffstat (limited to '')
| -rwxr-xr-x | transcode.sh | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/transcode.sh b/transcode.sh index 527c15c..a5a91d8 100755 --- a/transcode.sh +++ b/transcode.sh @@ -347,10 +347,6 @@ fi # Load ffmpeg argument preset by name. # -# Arguments: -# $1 - preset name -# $2 - name of the caller's array variable to populate (nameref) -# # Security: # Presets are sourced as shell code. Names are validated against a strict # allowlist (alphanumerics, hyphens, underscores only) to prevent path @@ -362,12 +358,8 @@ fi # The sourced preset MUST set the bash array `ffargs`. # Presets may reference variables from the caller (encode_one) such as: # output_pixel_format, input_pixel_format, input_codec -# On return the caller's array (named by $2) is populated with the preset's -# ffargs; the preset-local `ffargs` variable is unset before returning. load_preset() { local preset="$1" - local -n _load_preset_out="$2" - # Strict allowlist: only alphanumerics, hyphens, and underscores are permitted. # This prevents path traversal, shell metacharacter injection, and symlink-based # attacks more reliably than a blocklist approach. @@ -397,7 +389,8 @@ load_preset() { exit $EXIT_CONFIG_ERROR fi - local ffargs=() + unset -v ffargs + ffargs=() debug "Sourcing preset file:" "$file" @@ -410,8 +403,6 @@ load_preset() { } debug "Preset ffargs:" "$(printf "%q " "${ffargs[@]}")" - - _load_preset_out=("${ffargs[@]}") } if [[ $# -eq 0 ]]; then @@ -705,10 +696,7 @@ encode_one() { output_pixel_format="yuv${subsampling}${depth}" debug "Selected output pixel format:" "$output_pixel_format" - # Load preset early so a missing/invalid preset fails before we create a - # temp file or do any further work. - local ffargs=() - load_preset "$PRESET_NAME" ffargs + load_preset "$PRESET_NAME" local extension directory tmp base stem # filename (path without extension) is used only for the savings log. |
