Work around out-of-bounds vector access

This commit is contained in:
Jerry James 2024-03-13 11:22:05 -06:00
parent 3b6ae06355
commit 0d321955c9
2 changed files with 25 additions and 3 deletions

View File

@ -69,3 +69,24 @@
} }
rowranges[r].start += shift; 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<REAL>::execute( con
bool flag_b_integer = cflags[b].test( ColFlag::kIntegral );
if( flag_a_integer != flag_b_integer )
return !flag_a_integer;
+ SparseVectorView<REAL> coeffs_a = constMatrix.getColumnCoefficients( a );
+ SparseVectorView<REAL> 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 &&

View File

@ -30,6 +30,7 @@ Patch1: %{name}-shared.patch
# The list of tests in CMakeLists.txt doesn't match the actual tests # The list of tests in CMakeLists.txt doesn't match the actual tests
Patch2: %{name}-test.patch Patch2: %{name}-test.patch
# Avoid out-of-bounds vector access # Avoid out-of-bounds vector access
# https://github.com/scipopt/papilo/pull/48
Patch3: %{name}-vector-bounds.patch Patch3: %{name}-vector-bounds.patch
# See https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval # See https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
@ -56,9 +57,6 @@ BuildRequires: cmake(soplex)
Requires: libpapilo%{?_isa} = %{version}-%{release} 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: %global _desc %{expand:
PaPILO provides parallel presolve routines for (mixed integer) linear PaPILO provides parallel presolve routines for (mixed integer) linear
programming problems. The routines are implemented using templates programming problems. The routines are implemented using templates
@ -70,6 +68,9 @@ the boost multiprecision package.}
%package -n libpapilo %package -n libpapilo
Summary: Library interface to PaPILO 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 %description -n libpapilo %_desc
This package provides a library interface to the PaPILO functionality. This package provides a library interface to the PaPILO functionality.