Merge #226091: libde265: patch CVE-2023-27102 & CVE-2023-27103

...into staging
This commit is contained in:
Vladimír Čunát
2023-04-18 07:40:55 +02:00
2 changed files with 70 additions and 2 deletions

View File

@@ -1,9 +1,12 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, autoreconfHook
, pkg-config
, callPackage
# for passthru.tests
, imagemagick
, libheif
@@ -11,7 +14,7 @@
, gst_all_1
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: rec {
version = "1.0.11";
pname = "libde265";
@@ -22,6 +25,19 @@ stdenv.mkDerivation rec {
sha256 = "sha256-0aRUh5h49fnjBjy42A5fWYHnhnQ4CFoeSIXZilZewW8=";
};
patches = [
(fetchpatch {
name = "CVE-2023-27102.patch";
url = "https://github.com/strukturag/libde265/commit/0b1752abff97cb542941d317a0d18aa50cb199b1.patch";
sha256 = "sha256-q0NKuk2r5RQT9MJpRO3CTPj6VqYRBnffs9yZ+GM+lNc=";
})
(fetchpatch {
name = "CVE-2023-27103.patch";
url = "https://github.com/strukturag/libde265/commit/d6bf73e765b7a23627bfd7a8645c143fd9097995.patch";
sha256 = "sha256-vxciVzSuVCVDpdz+TKg2tMWp2ArubYji5GLaR9VP4F0=";
})
];
nativeBuildInputs = [ autoreconfHook pkg-config ];
enableParallelBuilding = true;
@@ -29,6 +45,10 @@ stdenv.mkDerivation rec {
passthru.tests = {
inherit imagemagick libheif imlib2Full;
inherit (gst_all_1) gst-plugins-bad;
test-corpus-decode = callPackage ./test-corpus-decode.nix {
libde265 = finalAttrs.finalPackage;
};
};
meta = {
@@ -38,4 +58,4 @@ stdenv.mkDerivation rec {
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ gebner ];
};
}
})

View File

@@ -0,0 +1,48 @@
{ lib
, stdenv
, fetchFromGitHub
, libde265
}:
stdenv.mkDerivation {
pname = "libde265-test-corpus-decode";
version = "unstable-2020-02-19";
src = fetchFromGitHub {
owner = "strukturag";
repo = "libde265-data";
rev = "bdfdfdbe682f514c5185c270c74eac42731a7fa8";
sha256 = "sha256-fOgu7vMoyH30Zzbkfm4a6JVDZtYLO/0R2syC2Wux+Z8=";
};
dontConfigure = true;
dontBuild = true;
doCheck = true;
nativeCheckInputs = [ libde265 ];
# based on invocations in https://github.com/strukturag/libde265/blob/0b1752abff97cb542941d317a0d18aa50cb199b1/scripts/ci-run.sh
checkPhase = ''
echo "Single-threaded:"
find . -name '*.bin' | while read f; do
echo "Decoding $f"
dec265 -q -c $f
dec265 -0 -q -c $f
dec265 -q --disable-deblocking --disable-sao $f
done
echo "Multi-threaded:"
find RandomAccess/ -name '*.bin' | while read f; do
echo "Decoding $f"
dec265 -t 4 -q -c $f
dec265 -t 4 -0 -q -c $f
dec265 -t 4 -q --disable-deblocking --disable-sao $f
done
'';
# a larger corpus of files can be found
# as an ubuntu package libde265-teststreams @
# https://launchpad.net/~strukturag/+archive/ubuntu/libde265/+packages
# but it is *much* larger
installPhase = ''
touch $out
'';
}