@@ -42,28 +42,24 @@ class ReallocationFunction extends AllocationFunction {
42
42
ReallocationFunction ( ) { exists ( this .getReallocPtrArg ( ) ) }
43
43
}
44
44
45
- /**
46
- * A data-flow state for a pointer which has not been reallocated.
47
- */
48
- class IndirectCastDefaultFlowState extends DataFlow:: FlowState {
49
- IndirectCastDefaultFlowState ( ) { this = "IndirectCastDefaultFlowState" }
50
- }
51
-
52
- /**
53
- * A data-flow state for a pointer which has been reallocated but
54
- * has not yet been zeroed with a memset call.
55
- */
56
- class IndirectCastReallocatedFlowState extends DataFlow:: FlowState {
57
- IndirectCastReallocatedFlowState ( ) { this = "IndirectCastReallocatedFlowState" }
58
- }
45
+ newtype IndirectCastFlowState =
46
+ /**
47
+ * A data-flow state for a pointer which has not been reallocated.
48
+ */
49
+ IndirectCastDefaultFlowState ( ) or
50
+ /**
51
+ * A data-flow state for a pointer which has been reallocated but
52
+ * has not yet been zeroed with a memset call.
53
+ */
54
+ IndirectCastReallocatedFlowState ( )
59
55
60
56
/**
61
57
* A data-flow configuration to track the flow from cast expressions to either
62
58
* other cast expressions or to dereferences of pointers reallocated with a call
63
59
* to `realloc` but not cleared via a function call to `memset`.
64
60
*/
65
61
module IndirectCastConfig implements DataFlow:: StateConfigSig {
66
- class FlowState = DataFlow :: FlowState ;
62
+ class FlowState = IndirectCastFlowState ;
67
63
68
64
predicate isSource ( DataFlow:: Node source , FlowState state ) {
69
65
state instanceof IndirectCastDefaultFlowState and
0 commit comments