Avoid OOM during compressed sing-box validation

This commit is contained in:
ushan0v
2026-07-12 02:05:57 +03:00
parent 8379be6c50
commit ae56d6742c
2 changed files with 13 additions and 2 deletions
+2 -2
View File
@@ -1523,15 +1523,15 @@ function install_sing_box_extended(action, compressed) {
}
}
remove_file(archive_file);
stop_forkop_before_sing_box_change();
let new_version = validate_sing_box_extended_binary(tmp_binary, tmp_dir);
if (new_version == "") {
remove_file(tmp_binary);
remove_file(tmp_cronet);
remove_file(archive_file);
action_fail("sing_box", action, "Downloaded " + label + " failed validation", current_version, latest_version);
}
stop_forkop_before_sing_box_change();
let backup_binary = "";
let backup_cronet = "";
let cronet_touched = false;
+11
View File
@@ -130,6 +130,17 @@ ucode "$WORK_DIR/action-command-success.uc" "$command_success_output" ||
assert_eq "extracted payload" "$(cat "$command_success_output")" \
"component command success preserves explicit output redirection"
awk '
prev2 == " remove_file(archive_file);" &&
prev1 == " stop_forkop_before_sing_box_change();" &&
$0 == " let new_version = validate_sing_box_extended_binary(tmp_binary, tmp_dir);" {
safe_validation = 1
}
{ prev2 = prev1; prev1 = $0 }
END { exit safe_validation ? 0 : 1 }
' "$ACTION_UC" ||
fail "compressed sing-box validation must release the archive and stop the running service to avoid OpenWrt OOM"
package_runtime_lib="$WORK_DIR/package-runtime-lib"
package_runtime_bin="$WORK_DIR/package-runtime-bin"
mkdir -p "$package_runtime_lib/components" "$package_runtime_lib/core" "$package_runtime_lib/singbox" "$package_runtime_bin"