From 1244b61710749be3fafb4ca48376415d7c81d49a Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Mon, 11 Aug 2014 00:18:54 +0200 Subject: [PATCH] [buddy] Fix a harmless uninitialized read. This can only cause failure when running under valgrind (i.e., in the test suite), but is not a problem in practice as the test is certain to fail the entry->c check whenever entry->b is uninitialized. * src/bddop.c (bdd_implies): Here. --- buddy/src/bddop.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/buddy/src/bddop.c b/buddy/src/bddop.c index bb79c7838..314459da5 100644 --- a/buddy/src/bddop.c +++ b/buddy/src/bddop.c @@ -917,7 +917,8 @@ int bdd_implies(BDD l, BDD r) return 0; entry = BddCache_lookup(&misccache, IMPLIESHASH(l,r)); - if (entry->a == l && entry->b == r && entry->c == CACHEID_IMPLIES) + // Check entry->b last, because not_rec() does not initialize it. + if (entry->a == l && entry->c == CACHEID_IMPLIES && entry->b == r) { #ifdef CACHESTATS bddcachestats.opHit++; @@ -1758,7 +1759,7 @@ static BDD simplify_rec(BDD f, BDD d) entry = BddCache_lookup(&applycache, APPLYHASH(f,d,bddop_simplify)); - // Check entry->c last, because not_rec() does not initialize it. + // Check entry->b last, because not_rec() does not initialize it. if (entry->a == f && entry->c == bddop_simplify && entry->b == d) { #ifdef CACHESTATS