Browse Source

JDD: Check for NULL ptr in Ref/Deref

Normally, we should catch the construction of JDDNodes with NULL pointers
beforehand, but for robustness we make sure that we do not call Cudd_Ref
and Cudd_Deref for a NULL DdNode*, as that leads to SIGSEGV crashes.


git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@10473 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Joachim Klein 11 years ago
parent
commit
2c2533eda8
  1. 20
      prism/src/jdd/JDD.java

20
prism/src/jdd/JDD.java

@ -265,9 +265,17 @@ public class JDD
*/
public static void Ref(JDDNode dd)
{
long ptr = dd.ptr();
// For robustness, catch NULL pointer
// In general, this should not happen,
// as constructing a JDDNode with NULL
// pointer should not happen...
if (ptr == 0) {
throw new CuddOutOfMemoryException();
}
if (DebugJDD.debugEnabled)
DebugJDD.increment(dd);
DD_Ref(dd.ptr());
DD_Ref(ptr);
}
/**
@ -276,9 +284,17 @@ public class JDD
*/
public static void Deref(JDDNode dd)
{
long ptr = dd.ptr();
// For robustness, catch NULL pointer
// In general, this should not happen,
// as constructing a JDDNode with NULL
// pointer should not happen...
if (ptr == 0) {
throw new CuddOutOfMemoryException();
}
if (DebugJDD.debugEnabled)
DebugJDD.decrement(dd);
DD_Deref(dd.ptr());
DD_Deref(ptr);
}
/**

Loading…
Cancel
Save