Skip to content

Commit c7dc420

Browse files
let me guess, ASAN doesn't like 0-byte memcpy
Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent 90415a1 commit c7dc420

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/nlsat/nlsat_justification.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ namespace nlsat {
4646
lazy_justification(unsigned nl, literal const * lits, unsigned nc, nlsat::clause * const* clss):
4747
m_num_literals(nl),
4848
m_num_clauses(nc) {
49-
memcpy(m_data + 0, clss, sizeof(nlsat::clause const*)*nc);
50-
memcpy(m_data + sizeof(nlsat::clause*)*nc, lits, sizeof(literal)*nl);
49+
if (nc > 0) {
50+
memcpy(m_data + 0, clss, sizeof(nlsat::clause*)*nc);
51+
}
52+
if (nl > 0) {
53+
memcpy(m_data + sizeof(nlsat::clause*)*nc, lits, sizeof(literal)*nl);
54+
}
5155
}
5256
unsigned num_lits() const { return m_num_literals; }
5357
literal lit(unsigned i) const { SASSERT(i < num_lits()); return lits()[i]; }

0 commit comments

Comments
 (0)