From 0d321955c90e4cad1bd3d7a3b5064f8319917d6c Mon Sep 17 00:00:00 2001 From: Jerry James Date: Wed, 13 Mar 2024 11:22:05 -0600 Subject: [PATCH] Work around out-of-bounds vector access --- papilo-vector-bounds.patch | 21 +++++++++++++++++++++ papilo.spec | 7 ++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/papilo-vector-bounds.patch b/papilo-vector-bounds.patch index 8ba1e33..6ee1e72 100644 --- a/papilo-vector-bounds.patch +++ b/papilo-vector-bounds.patch @@ -69,3 +69,24 @@ } rowranges[r].start += shift; +--- papilo-2.2.0/src/papilo/presolvers/ParallelColDetection.hpp.orig 2024-02-19 15:44:49.657384704 -0700 ++++ papilo-2.2.0/src/papilo/presolvers/ParallelColDetection.hpp 2024-03-06 06:48:56.980339757 -0700 +@@ -588,13 +588,16 @@ ParallelColDetection::execute( con + bool flag_b_integer = cflags[b].test( ColFlag::kIntegral ); + if( flag_a_integer != flag_b_integer ) + return !flag_a_integer; ++ SparseVectorView coeffs_a = constMatrix.getColumnCoefficients( a ); ++ SparseVectorView coeffs_b = constMatrix.getColumnCoefficients( b ); ++ REAL coeff_a = (coeffs_a.getLength() > 0) ? coeffs_a.getValues()[0] : (REAL)0; ++ REAL coeff_b = (coeffs_b.getLength() > 0) ? coeffs_b.getValues()[0] : (REAL)0; + return // sort by scale factor + abs( obj[a] ) < abs( obj[b] ) || + // sort by scale factor if obj is zero + ( abs( obj[a] ) == abs( obj[b] ) && obj[a] == 0 && + determineOderingForZeroObj( +- constMatrix.getColumnCoefficients( a ).getValues()[0], +- constMatrix.getColumnCoefficients( b ).getValues()[0], ++ coeff_a, coeff_b, + colperm[a], colperm[b] ) ) || + // sort by permutation + ( abs( obj[a] ) == abs( obj[b] ) && obj[a] != 0 && diff --git a/papilo.spec b/papilo.spec index 26637e3..e156569 100644 --- a/papilo.spec +++ b/papilo.spec @@ -30,6 +30,7 @@ Patch1: %{name}-shared.patch # The list of tests in CMakeLists.txt doesn't match the actual tests Patch2: %{name}-test.patch # Avoid out-of-bounds vector access +# https://github.com/scipopt/papilo/pull/48 Patch3: %{name}-vector-bounds.patch # See https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval @@ -56,9 +57,6 @@ BuildRequires: cmake(soplex) Requires: libpapilo%{?_isa} = %{version}-%{release} -# The bundled version of fmt is incompatible with version 10 in Rawhide. -Provides: bundled(fmt) = 6.1.2 - %global _desc %{expand: PaPILO provides parallel presolve routines for (mixed integer) linear programming problems. The routines are implemented using templates @@ -70,6 +68,9 @@ the boost multiprecision package.} %package -n libpapilo Summary: Library interface to PaPILO +# The bundled version of fmt is incompatible with version 10 in Rawhide. +Provides: bundled(fmt) = 6.1.2 + %description -n libpapilo %_desc This package provides a library interface to the PaPILO functionality.