office-gobmx/external/lpsolve/lpsolve-ubsan.patch.0
Stephan Bergmann 65b239f8ca 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>
2019-10-22 16:50:31 +02:00

22 lines
626 B
Text

--- 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 @@
/* Store the active/current pricing type */
if(isdual == AUTOMATIC)
- isdual = (MYBOOL) lp->edgeVector[0];
+ isdual = lp->edgeVector[0] != 0.0;
else
lp->edgeVector[0] = isdual;