summaryrefslogtreecommitdiffstats
path: root/src/aig/gia/giaTruth.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-11-02 12:02:16 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-11-02 12:02:16 -0700
commit96d3348d8ffc7324472c9fa8e65d1d4c9e4752df (patch)
tree8421dd238219a9cfa6996a26710e3435ae9879bf /src/aig/gia/giaTruth.c
parentf829eca5483d4bec52bc1f090f8e7def180b3454 (diff)
downloadabc-96d3348d8ffc7324472c9fa8e65d1d4c9e4752df.tar.gz
abc-96d3348d8ffc7324472c9fa8e65d1d4c9e4752df.tar.bz2
abc-96d3348d8ffc7324472c9fa8e65d1d4c9e4752df.zip
Fixing out-of-bound problem when collecting GIA nodes.
Diffstat (limited to 'src/aig/gia/giaTruth.c')
-rw-r--r--src/aig/gia/giaTruth.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/aig/gia/giaTruth.c b/src/aig/gia/giaTruth.c
index 24d8d879..d8a1bb49 100644
--- a/src/aig/gia/giaTruth.c
+++ b/src/aig/gia/giaTruth.c
@@ -105,23 +105,28 @@ word Gia_ObjComputeTruthTable6( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vSu
SeeAlso []
***********************************************************************/
-void Gia_ObjCollectInternal_rec( Gia_Man_t * p, Gia_Obj_t * pObj )
+int Gia_ObjCollectInternal_rec( Gia_Man_t * p, Gia_Obj_t * pObj )
{
if ( !Gia_ObjIsAnd(pObj) )
- return;
+ return 0;
if ( pObj->fMark0 )
- return;
+ return 0;
pObj->fMark0 = 1;
Gia_ObjCollectInternal_rec( p, Gia_ObjFanin0(pObj) );
Gia_ObjCollectInternal_rec( p, Gia_ObjFanin1(pObj) );
+ if ( Vec_IntSize(p->vTtNodes) > 253 )
+ return 1;
Gia_ObjSetNum( p, pObj, Vec_IntSize(p->vTtNodes) );
Vec_IntPush( p->vTtNodes, Gia_ObjId(p, pObj) );
+ return 0;
}
-void Gia_ObjCollectInternal( Gia_Man_t * p, Gia_Obj_t * pObj )
+int Gia_ObjCollectInternal( Gia_Man_t * p, Gia_Obj_t * pObj )
{
+ int RetValue;
Vec_IntClear( p->vTtNodes );
- Gia_ObjCollectInternal_rec( p, pObj );
+ RetValue = Gia_ObjCollectInternal_rec( p, pObj );
assert( Vec_IntSize(p->vTtNodes) < 254 );
+ return RetValue;
}
/**Function*************************************************************
@@ -158,7 +163,12 @@ unsigned * Gia_ObjComputeTruthTable( Gia_Man_t * p, Gia_Obj_t * pObj )
}
// collect internal nodes
pRoot = Gia_ObjIsCo(pObj) ? Gia_ObjFanin0(pObj) : pObj;
- Gia_ObjCollectInternal( p, pRoot );
+ if ( Gia_ObjCollectInternal( p, pRoot ) )
+ {
+ Gia_ManForEachObjVec( p->vTtNodes, p, pTemp, i )
+ pTemp->fMark0 = 0;
+ return NULL;
+ }
// compute the truth table for internal nodes
Gia_ManForEachObjVec( p->vTtNodes, p, pTemp, i )
{