diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2018-12-06 15:23:00 -0800 |
---|---|---|
committer | Alex Ozdemir <aozdemir@hmc.edu> | 2018-12-06 15:23:00 -0800 |
commit | 63fb4e8c33db706589fe41476c4d3358fb47164e (patch) | |
tree | 75a4545317546c97d2578474ced2879b157f471c /src/proof/proof.h | |
parent | 7145d0772794013fd6eb2f145a43a30be64aa557 (diff) |
Fix use-after-free due to destruction order (#2739)
A test for PR #2737 was failing even though the PR only added dead code.
This PR fixes the issue by fixing two use-after-free bugs:
- `ResolutionBitVectorProof` has a `Context` and a
`std::unique_ptr<BVSatProof>` member. The `BVSatProof` depends on the
`Context` and tries to access it (indirectly) in its constructor but
because the context was declared after the proof, the context was
destroyed before the proof, leading to a use-after-free in a method
called from the proof's destructor. This commit reorders the two
members.
- `TLazyBitblaster` was destroyed before the `LFSCCnfProof` in
`BitVectorProof` because `SmtEngine`'s destructor first destroyed the
theory engine and then the proof manager. This lead to a use-after-free
because `LFSCCnfProof` was using the `d_nullContext` of
`TLazyBitblaster`, which got indirectly accessed in `LFSCCnfProof`'s
destructor. This commit moves the destruction of `ProofManager` above
the destruction of the theory engine.
The issues were likely introduced by #2599. They went undetected because
our nightlies' ASAN check does not use proofs due to known memory leaks
in the proof module of CVC4.
I have tested this PR up to regression level 2 with ASAN with leak
detection disabled.
Diffstat (limited to 'src/proof/proof.h')
0 files changed, 0 insertions, 0 deletions