mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C++: Address review comments
This commit is contained in:
@@ -4144,16 +4144,15 @@ class TranslatedSizeofExpr extends TranslatedNonConstantExpr {
|
|||||||
exists(int n, Type dimType |
|
exists(int n, Type dimType |
|
||||||
pointerDerefCount <= n and
|
pointerDerefCount <= n and
|
||||||
n < vlaDimensions and
|
n < vlaDimensions and
|
||||||
dimType = vlaDeclStmt.getTransitiveVlaDimensionStmt(n).getDimensionExpr().getUnderlyingType()
|
dimType = this.getDimensionExpr(n).getUnderlyingType() and
|
||||||
|
tag = SizeofVlaConversionTag(n)
|
||||||
|
|
|
|
||||||
(
|
(
|
||||||
expr.getUnderlyingType() = dimType and
|
expr.getUnderlyingType() = dimType and
|
||||||
opcode instanceof Opcode::CopyValue and
|
opcode instanceof Opcode::CopyValue
|
||||||
tag = SizeofVlaConversionTag(n)
|
|
||||||
or
|
or
|
||||||
not expr.getUnderlyingType() = dimType and
|
not expr.getUnderlyingType() = dimType and
|
||||||
opcode instanceof Opcode::Convert and
|
opcode instanceof Opcode::Convert
|
||||||
tag = SizeofVlaConversionTag(n)
|
|
||||||
)
|
)
|
||||||
) and
|
) and
|
||||||
resultType = this.getResultType()
|
resultType = this.getResultType()
|
||||||
@@ -4213,9 +4212,7 @@ class TranslatedSizeofExpr extends TranslatedNonConstantExpr {
|
|||||||
tag = SizeofVlaConversionTag(n) and
|
tag = SizeofVlaConversionTag(n) and
|
||||||
(
|
(
|
||||||
operandTag instanceof UnaryOperandTag and
|
operandTag instanceof UnaryOperandTag and
|
||||||
result =
|
result = getTranslatedExpr(this.getDimensionExpr(n)).getResult()
|
||||||
getTranslatedExpr(vlaDeclStmt.getTransitiveVlaDimensionStmt(n).getDimensionExpr())
|
|
||||||
.getResult()
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -4237,6 +4234,10 @@ class TranslatedSizeofExpr extends TranslatedNonConstantExpr {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Expr getDimensionExpr(int n) {
|
||||||
|
result = vlaDeclStmt.getTransitiveVlaDimensionStmt(n).getDimensionExpr().getFullyConverted()
|
||||||
|
}
|
||||||
|
|
||||||
final override Instruction getResult() {
|
final override Instruction getResult() {
|
||||||
result = this.getInstruction(SizeofVlaDimensionTag(vlaDimensions - 1))
|
result = this.getInstruction(SizeofVlaDimensionTag(vlaDimensions - 1))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user