Project Name | CID | Checker | Category | Developer Description |
---|---|---|---|---|
CalebFenton/simplify | 33615 | FORWARD_NULL | Null pointer dereferences | This fault is buried deep within some complex logic that makes it really hard to track. These types of problems usually lead to insidious correctness errors since exceptions are caught at a higher level. |
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
newChild.setParent(this); } public void setContext(ExecutionContext ectx) { this.ectx = ectx; } public void setException(VirtualException exception) { exceptions = new HashSet<VirtualException>(); exceptions.add(exception); } public void setExceptions(Set<VirtualException> exceptions) { this.exceptions = exceptions; } public void setMethodState(MethodState mState) { ectx.setMethodState(mState); } public void setParent(ExecutionNode parent) { // All nodes will have [0,1] parents since a node represents both an instruction and a context, or vm state. // Each execution of an instruction will have a new state. this.parent = parent; |
< 1. Condition "parent != null", taking false branch
<< 2. Comparing "parent" to null implies that "parent" might be null.
149 150 151 |
if (parent != null) { parent.addChild(this); } |
<<< CID 33615: Null pointer dereferences FORWARD_NULL <<< 3. Calling a method on null object "parent".
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
getContext().setParent(parent.getContext()); } public ExecutionNode spawnChild(Op childOp) { ExecutionNode child = new ExecutionNode(childOp); child.setContext(ectx.spawnChild()); child.setParent(this); return child; } @Override public String toString() { return op.toString(); } private void addChild(ExecutionNode child) { children.add(child); rebuildChildLocationsFromChildren(); } } |
2. var_compare_op | ExecutionNode.java:149 | |
3. null_method_call | ExecutionNode.java:152 |