summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-10-22 11:54:02 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-10-22 16:50:31 +0200
commit65b239f8cab7e5a82438a617d8d9e022fc441138 (patch)
tree58045a7450d34b35427b9de43117a086eeafd32f
parent3331b91f78519b6c208be9318983d741f4e2ea6b (diff)
external/lpsolve: Avoid UBSan nullptr-with-nonzero-offset
...(new with Clang 10 trunk), as seen during CppunitTest_sccomp_solver: > ../lp_presolve.c:171:34: runtime error: applying non-zero offset 8 to null pointer > #0 in presolve_rebuildUndo at workdir/UnpackedTarball/lpsolve/lpsolve55/../lp_presolve.c:171:34 > #1 in postsolve at workdir/UnpackedTarball/lpsolve/lpsolve55/../lp_presolve.c:5673:5 > #2 in spx_solve at workdir/UnpackedTarball/lpsolve/lpsolve55/../lp_simplex.c:2067:9 > #3 in lin_solve at workdir/UnpackedTarball/lpsolve/lpsolve55/../lp_simplex.c:2159:12 > #4 in LpsolveSolver::solve() at sccomp/source/solver/LpsolveSolver.cxx:295:19 > #5 in (anonymous namespace)::LpSolverTest::testSolver(rtl::OUString const&) at sccomp/qa/unit/solver.cxx:106:14 > #6 in (anonymous namespace)::LpSolverTest::testLpSolver() at sccomp/qa/unit/solver.cxx:69:5 I have no idea whether this even remotely resembles a useful fix, though. Change-Id: I1a2796d3849967576f400737082e7377566aece9 Reviewed-on: https://gerrit.libreoffice.org/81321 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--external/lpsolve/lpsolve-ubsan.patch.011
1 files changed, 11 insertions, 0 deletions
diff --git a/external/lpsolve/lpsolve-ubsan.patch.0 b/external/lpsolve/lpsolve-ubsan.patch.0
index 29e9ad3b3c1a..7a5e308c6efd 100644
--- a/external/lpsolve/lpsolve-ubsan.patch.0
+++ b/external/lpsolve/lpsolve-ubsan.patch.0
@@ -1,3 +1,14 @@
+--- lp_presolve.c
++++ lp_presolve.c
+@@ -168,7 +168,7 @@
+ if(isprimal) {
+ if(psdata->primalundo != NULL)
+ mat = psdata->primalundo->tracker;
+- solution = lp->full_solution + lp->presolve_undo->orig_rows;
++ solution = lp->full_solution == NULL ? NULL : lp->full_solution + lp->presolve_undo->orig_rows;
+ slacks = lp->full_solution;
+ }
+ else {
--- lp_pricePSE.c
+++ lp_pricePSE.c
@@ -145,7 +147,7 @@