mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 15:41:30 -07:00
groupsolver: fix segfault accessing solver->names.
Reproduced via 'groupsolver -v 5i:l5_2b5h' (thanks to Arun Giridhar for the report). We had filled in subsolver.names, but then called latin_solver_alloc(&subsolver), which nulled out that pointer again. Solution: do those two things in the opposite order.
This commit is contained in:
7
latin.c
7
latin.c
@ -819,17 +819,18 @@ static int latin_solver_recurse
|
|||||||
} else {
|
} else {
|
||||||
newctx = ctx;
|
newctx = ctx;
|
||||||
}
|
}
|
||||||
|
if (latin_solver_alloc(&subsolver, outgrid, o)) {
|
||||||
#ifdef STANDALONE_SOLVER
|
#ifdef STANDALONE_SOLVER
|
||||||
subsolver.names = solver->names;
|
subsolver.names = solver->names;
|
||||||
#endif
|
#endif
|
||||||
if (latin_solver_alloc(&subsolver, outgrid, o))
|
|
||||||
ret = latin_solver_top(&subsolver, diff_recursive,
|
ret = latin_solver_top(&subsolver, diff_recursive,
|
||||||
diff_simple, diff_set_0, diff_set_1,
|
diff_simple, diff_set_0, diff_set_1,
|
||||||
diff_forcing, diff_recursive,
|
diff_forcing, diff_recursive,
|
||||||
usersolvers, valid, newctx,
|
usersolvers, valid, newctx,
|
||||||
ctxnew, ctxfree);
|
ctxnew, ctxfree);
|
||||||
else
|
} else {
|
||||||
ret = diff_impossible;
|
ret = diff_impossible;
|
||||||
|
}
|
||||||
latin_solver_free(&subsolver);
|
latin_solver_free(&subsolver);
|
||||||
if (ctxnew)
|
if (ctxnew)
|
||||||
ctxfree(newctx);
|
ctxfree(newctx);
|
||||||
|
Reference in New Issue
Block a user