From 09ad6013c68ecfb655bfe613b4ecb10acb32cca3 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 6 Nov 2025 12:22:24 +0100 Subject: [PATCH] spandsp: backport additional memory safety fix This one caused a test failure on x86_64-unknown-linux-musl. Closes: https://github.com/NixOS/nixpkgs/issues/458398 See PR #459116 --- .../development/libraries/spandsp/default.nix | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/spandsp/default.nix b/pkgs/development/libraries/spandsp/default.nix index 9720e110f7cf..87996abdeeb0 100644 --- a/pkgs/development/libraries/spandsp/default.nix +++ b/pkgs/development/libraries/spandsp/default.nix @@ -2,6 +2,8 @@ fetchurl, fetchpatch, callPackage, + lib, + stdenv, }: (callPackage ./common.nix { }) rec { @@ -11,11 +13,31 @@ sha256 = "0rclrkyspzk575v8fslzjpgp4y2s4x7xk3r55ycvpi4agv33l1fc"; }; patches = [ - (fetchpatch { - url = "https://github.com/freeswitch/spandsp/commit/f7b96b08db148763039cf3459d0e00da9636eb92.patch"; - includes = [ "spandsp-sim/g1050.c" ]; - hash = "sha256-TwMhWJXQG/UaWddWgice0klp1uATyHMiE6DcsCebXYQ="; - }) + # FIXME: clean up rebuild avoidance on staging. + ( + if + lib.elem stdenv.hostPlatform.config [ + "arm64-apple-darwin" + "aarch64-unknown-linux-gnu" + "x86_64-apple-darwin" + "x86_64-unknown-linux-gnu" + ] + then + fetchpatch { + url = "https://github.com/freeswitch/spandsp/commit/f7b96b08db148763039cf3459d0e00da9636eb92.patch"; + includes = [ "spandsp-sim/g1050.c" ]; + hash = "sha256-TwMhWJXQG/UaWddWgice0klp1uATyHMiE6DcsCebXYQ="; + } + else + fetchpatch { + url = "https://github.com/freeswitch/spandsp/commit/f7b96b08db148763039cf3459d0e00da9636eb92.patch"; + includes = [ + "spandsp-sim/g1050.c" + "spandsp-sim/test_utils.c" + ]; + hash = "sha256-2MmVgyMUK0Zn+mL7IX57Y7brYpgmt4GVlis5/NstuNM="; + } + ) (fetchpatch { url = "https://github.com/freeswitch/spandsp/commit/f47bcdc301fbddad44e918939eed1b361882f740.patch"; hash = "sha256-O+lIC3V92GVFoiHsUQOXkoTN2hJ7v5+LQP7RrAhvwlY=";