Skip to content

Commit 3072e9c

Browse files
author
Dave Bartolomeo
authored
Merge pull request #2598 from geoffw0/av114_asm
CPP: Exclude functions containing asm from cpp/missing-return
2 parents d918cb1 + c584ceb commit 3072e9c

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

change-notes/1.24/analysis-cpp.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The following changes in version 1.24 affect C/C++ analysis in all applications.
1717
| No space for zero terminator (`cpp/no-space-for-terminator`) | More true positive results | This query now identifies a wider variety of buffer allocations using the `semmle.code.cpp.models.interfaces.Allocation` library. |
1818
| Memory is never freed (`cpp/memory-never-freed`) | More true positive results | This query now identifies a wider variety of buffer allocations using the `semmle.code.cpp.models.interfaces.Allocation` library. |
1919
| Memory may not be freed (`cpp/memory-may-not-be-freed`) | More true positive results | This query now identifies a wider variety of buffer allocations using the `semmle.code.cpp.models.interfaces.Allocation` library. |
20+
| Missing return statement (`cpp/missing-return`) | Fewer false positive results | Functions containing `asm` statements are no longer highlighted by this query. |
2021
| Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) | | This query is no longer run on LGTM. |
2122
| No space for zero terminator (`cpp/no-space-for-terminator`) | Fewer false positive results | This query has been modified to be more conservative when identifying which pointers point to null-terminated strings. This approach produces fewer, more accurate results. |
2223
| Unsafe array for days of the year (`cpp/leap-year/unsafe-array-for-days-of-the-year`) | | This query is no longer run on LGTM. |

cpp/ql/src/jsf/4.13 Functions/AV Rule 114.ql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ predicate functionImperfectlyExtracted(Function f) {
4646
exists(ErrorExpr ee | ee.getEnclosingFunction() = f)
4747
or
4848
count(f.getType()) > 1
49+
or
50+
// an `AsmStmt` isn't strictly 'imperfectly extracted', but it's beyond the scope
51+
// of this analysis.
52+
exists(AsmStmt asm | asm.getEnclosingFunction() = f)
4953
}
5054

5155
from Stmt stmt, string msg, Function f, ControlFlowNode blame

cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/test.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,8 @@ void f13_func(int x)
9494
{
9595
if (x < 10) return; // GOOD
9696
}
97+
98+
int f14()
99+
{
100+
__asm__("rdtsc"); // GOOD
101+
}

0 commit comments

Comments
 (0)