Formatting and updating tests.

This commit is contained in:
REDMOND\brodes
2024-08-12 11:21:55 -04:00
parent f0eeaaf44e
commit e4d29905a9
3 changed files with 23 additions and 15 deletions

View File

@@ -14,8 +14,8 @@ int getPointedSize(Type t) {
* BufferWrite differ.
*/
abstract class BufferAccess extends Expr {
BufferAccess() {
not this.isUnevaluated() and
BufferAccess() {
not this.isUnevaluated() and
//A buffer access must be reachable (not in dead code)
reachable(this)
}

View File

@@ -31,9 +31,9 @@ edges
| main.cpp:9:29:9:32 | *argv | tests_restrict.c:15:41:15:44 | *argv | provenance | |
| main.cpp:9:29:9:32 | tests_restrict_main output argument | main.cpp:10:20:10:23 | **argv | provenance | |
| main.cpp:9:29:9:32 | tests_restrict_main output argument | main.cpp:10:20:10:23 | *argv | provenance | |
| main.cpp:10:20:10:23 | **argv | tests.cpp:664:32:664:35 | **argv | provenance | |
| main.cpp:10:20:10:23 | *argv | tests.cpp:664:32:664:35 | **argv | provenance | |
| main.cpp:10:20:10:23 | *argv | tests.cpp:664:32:664:35 | *argv | provenance | |
| main.cpp:10:20:10:23 | **argv | tests.cpp:672:32:672:35 | **argv | provenance | |
| main.cpp:10:20:10:23 | *argv | tests.cpp:672:32:672:35 | **argv | provenance | |
| main.cpp:10:20:10:23 | *argv | tests.cpp:672:32:672:35 | *argv | provenance | |
| overflowdestination.cpp:23:45:23:48 | **argv | overflowdestination.cpp:23:45:23:48 | **argv | provenance | |
| overflowdestination.cpp:23:45:23:48 | **argv | overflowdestination.cpp:23:45:23:48 | *argv | provenance | |
| test_buffer_overrun.cpp:32:46:32:49 | **argv | test_buffer_overrun.cpp:32:46:32:49 | **argv | provenance | |
@@ -46,12 +46,12 @@ edges
| tests.cpp:628:14:628:14 | *s [*home] | tests.cpp:628:14:628:19 | *home | provenance | |
| tests.cpp:628:14:628:14 | *s [*home] | tests.cpp:628:16:628:19 | *home | provenance | |
| tests.cpp:628:16:628:19 | *home | tests.cpp:628:14:628:19 | *home | provenance | |
| tests.cpp:664:32:664:35 | **argv | tests.cpp:689:9:689:15 | *access to array | provenance | |
| tests.cpp:664:32:664:35 | **argv | tests.cpp:690:9:690:15 | *access to array | provenance | |
| tests.cpp:664:32:664:35 | *argv | tests.cpp:689:9:689:15 | *access to array | provenance | |
| tests.cpp:664:32:664:35 | *argv | tests.cpp:690:9:690:15 | *access to array | provenance | |
| tests.cpp:689:9:689:15 | *access to array | tests.cpp:613:19:613:24 | *source | provenance | |
| tests.cpp:690:9:690:15 | *access to array | tests.cpp:622:19:622:24 | *source | provenance | |
| tests.cpp:672:32:672:35 | **argv | tests.cpp:697:9:697:15 | *access to array | provenance | |
| tests.cpp:672:32:672:35 | **argv | tests.cpp:698:9:698:15 | *access to array | provenance | |
| tests.cpp:672:32:672:35 | *argv | tests.cpp:697:9:697:15 | *access to array | provenance | |
| tests.cpp:672:32:672:35 | *argv | tests.cpp:698:9:698:15 | *access to array | provenance | |
| tests.cpp:697:9:697:15 | *access to array | tests.cpp:613:19:613:24 | *source | provenance | |
| tests.cpp:698:9:698:15 | *access to array | tests.cpp:622:19:622:24 | *source | provenance | |
| tests_restrict.c:15:41:15:44 | **argv | tests_restrict.c:15:41:15:44 | **argv | provenance | |
| tests_restrict.c:15:41:15:44 | *argv | tests_restrict.c:15:41:15:44 | *argv | provenance | |
nodes
@@ -85,10 +85,10 @@ nodes
| tests.cpp:628:14:628:14 | *s [*home] | semmle.label | *s [*home] |
| tests.cpp:628:14:628:19 | *home | semmle.label | *home |
| tests.cpp:628:16:628:19 | *home | semmle.label | *home |
| tests.cpp:664:32:664:35 | **argv | semmle.label | **argv |
| tests.cpp:664:32:664:35 | *argv | semmle.label | *argv |
| tests.cpp:689:9:689:15 | *access to array | semmle.label | *access to array |
| tests.cpp:690:9:690:15 | *access to array | semmle.label | *access to array |
| tests.cpp:672:32:672:35 | **argv | semmle.label | **argv |
| tests.cpp:672:32:672:35 | *argv | semmle.label | *argv |
| tests.cpp:697:9:697:15 | *access to array | semmle.label | *access to array |
| tests.cpp:698:9:698:15 | *access to array | semmle.label | *access to array |
| tests_restrict.c:15:41:15:44 | **argv | semmle.label | **argv |
| tests_restrict.c:15:41:15:44 | **argv | semmle.label | **argv |
| tests_restrict.c:15:41:15:44 | *argv | semmle.label | *argv |

View File

@@ -657,10 +657,18 @@ void test26(bool cond)
void test27(){
char *src = "";
char *dest = "abcdefgh";
const int size = 100;
int ind = 100;
char buffer[size];
strncpy(dest, src, strlen(dest)); // GOOD, strncpy will not read past null terminator of source
if(ind < size){
buffer[ind] = 0; // GOOD: out of bounds, but inaccessible code
}
}
int tests_main(int argc, char *argv[])
{
long long arr17[19];