C++: respond to PR comments.

This commit is contained in:
Robert Marsh
2020-02-11 12:17:46 -08:00
parent 3266a89023
commit f467260815
8 changed files with 10 additions and 11 deletions

View File

@@ -1342,7 +1342,7 @@ class SizedBufferMayWriteSideEffectInstruction extends WriteSideEffectInstructio
/**
* An instruction representing the initial value of newly allocated memory, e.g. the result of a
* call to `malloc`
* call to `malloc`.
*/
class InitializeDynamicAllocationInstruction extends SideEffectInstruction {
InitializeDynamicAllocationInstruction() {

View File

@@ -105,7 +105,7 @@ class DynamicAllocation extends Allocation, TDynamicAllocation {
DynamicAllocation() { this = TDynamicAllocation(call) }
final override string toString() {
result = call.toString() + " at " + call.getLocation() // TODO: make this both short and unique
result = call.toString() + " at " + call.getLocation() // This isn't performant, but it's only used in test/dump code right not
}
final override CallInstruction getABaseInstruction() { result = call }
@@ -116,9 +116,7 @@ class DynamicAllocation extends Allocation, TDynamicAllocation {
final override string getUniqueId() { result = call.getUniqueId() }
final override IRType getIRType() {
result instanceof IRUnknownType // TODO: look at casts and sizes?
}
final override IRType getIRType() { result instanceof IRUnknownType }
final override predicate isReadOnly() { none() }

View File

@@ -1342,7 +1342,7 @@ class SizedBufferMayWriteSideEffectInstruction extends WriteSideEffectInstructio
/**
* An instruction representing the initial value of newly allocated memory, e.g. the result of a
* call to `malloc`
* call to `malloc`.
*/
class InitializeDynamicAllocationInstruction extends SideEffectInstruction {
InitializeDynamicAllocationInstruction() {

View File

@@ -345,7 +345,7 @@ class TranslatedSideEffects extends TranslatedElement, TTranslatedSideEffects {
expr.getTarget() instanceof AllocationFunction and
opcode instanceof Opcode::InitializeDynamicAllocation and
tag = OnlyInstructionTag() and
type = getUnknownType() // TODO: precise type
type = getUnknownType()
}
override Instruction getFirstInstruction() {
@@ -357,6 +357,7 @@ class TranslatedSideEffects extends TranslatedElement, TTranslatedSideEffects {
override Instruction getInstructionSuccessor(InstructionTag tag, EdgeKind kind) {
tag = OnlyInstructionTag() and
kind = gotoEdge() and
expr.getTarget() instanceof AllocationFunction and
if exists(getChild(0))
then result = getChild(0).getFirstInstruction()
else result = getParent().getChildSuccessor(this)

View File

@@ -1342,7 +1342,7 @@ class SizedBufferMayWriteSideEffectInstruction extends WriteSideEffectInstructio
/**
* An instruction representing the initial value of newly allocated memory, e.g. the result of a
* call to `malloc`
* call to `malloc`.
*/
class InitializeDynamicAllocationInstruction extends SideEffectInstruction {
InitializeDynamicAllocationInstruction() {

View File

@@ -2,4 +2,4 @@
* Support for tracking tainted data through the program.
*/
import TaintTrackingImpl
import semmle.code.cpp.ir.dataflow.DefaultTaintTracking