From c0e252846e1f67855c3eb5fb6ae909d8c65fe1af Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Wed, 24 Dec 2025 10:30:38 +0100 Subject: [PATCH] Fix memory corruption in &mfs. --- src/opt/sfm/sfmCnf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/opt/sfm/sfmCnf.c b/src/opt/sfm/sfmCnf.c index 7c917fa7e..93dd976c8 100644 --- a/src/opt/sfm/sfmCnf.c +++ b/src/opt/sfm/sfmCnf.c @@ -111,8 +111,10 @@ int Sfm_TruthToCnf( word Truth, word * pTruth, int nVars, Vec_Int_t * vCover, Ve int i, k, c, RetValue, Literal, Cube, nCubes = 0; assert( nVars > 0 ); - Abc_TtFlipVar5( &Truth, nVars ); - Abc_TtFlipVar5( pTruth, nVars ); + if ( nVars <= 6) + Abc_TtFlipVar5( &Truth, nVars ); + else + Abc_TtFlipVar5( pTruth, nVars ); for ( c = 0; c < 2; c ++ ) { if ( nVars <= 6 ) @@ -148,7 +150,8 @@ int Sfm_TruthToCnf( word Truth, word * pTruth, int nVars, Vec_Int_t * vCover, Ve Vec_StrPush( vCnf, (char)-1 ); } } - Abc_TtFlipVar5( pTruth, nVars ); + if (nVars > 6) + Abc_TtFlipVar5( pTruth, nVars ); return nCubes; }