Skip to content

Commit 7428ee5

Browse files
Merge pull request #583 from diffblue/master
Update security-scanner-support to current master
2 parents 85e7920 + c8c9085 commit 7428ee5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1687
-563
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ matrix:
2828
packages:
2929
- libwww-perl
3030
- clang-3.7
31+
- libstdc++-5-dev
3132
- libubsan0
3233
before_install:
3334
- mkdir bin ; ln -s /usr/bin/clang-3.7 bin/gcc
222 Bytes
Binary file not shown.
222 Bytes
Binary file not shown.
292 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
test.class
3+
--lazy-methods --verbosity 10 --function test.main
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
elaborate java::A\.f:\(\)V
7+
--
8+
elaborate java::B\.g:\(\)V
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// The most basic lazy loading test: A::f is directly called, B::g should be unreachable
2+
3+
public class test
4+
{
5+
A a;
6+
B b;
7+
public static void main()
8+
{
9+
A.f();
10+
}
11+
}
12+
13+
class A
14+
{
15+
public static void f() {}
16+
}
17+
18+
class B
19+
{
20+
public static void g() {}
21+
}
222 Bytes
Binary file not shown.
222 Bytes
Binary file not shown.
310 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
test.class
3+
--lazy-methods --verbosity 10 --function test.main
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
elaborate java::A\.f:\(\)V
7+
--
8+
elaborate java::B\.g:\(\)V
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// This test checks that because A is instantiated in main and B is not,
2+
// A::f is reachable and B::g is not
3+
4+
public class test
5+
{
6+
A a;
7+
B b;
8+
public static void main()
9+
{
10+
A a = new A();
11+
a.f();
12+
}
13+
}
14+
15+
class A
16+
{
17+
public void f() {}
18+
}
19+
20+
class B
21+
{
22+
public void g() {}
23+
}
222 Bytes
Binary file not shown.
222 Bytes
Binary file not shown.
197 Bytes
Binary file not shown.
197 Bytes
Binary file not shown.
296 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
test.class
3+
--lazy-methods --verbosity 10 --function test.main
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
elaborate java::A\.f:\(\)V
7+
--
8+
elaborate java::B\.g:\(\)V
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// This test checks that because `main` has a parameter of type C, which has a field of type A,
2+
// A::f is considered reachable, but B::g is not.
3+
4+
public class test
5+
{
6+
public static void main(C c)
7+
{
8+
c.a.f();
9+
}
10+
}
11+
12+
class A
13+
{
14+
public void f() {}
15+
}
16+
17+
class B
18+
{
19+
public void g() {}
20+
}
21+
22+
class C
23+
{
24+
A a;
25+
}
26+
27+
class D
28+
{
29+
B b;
30+
}

regression/failed-tests-printer.pl

+12-10
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@
44

55
open LOG,"<tests.log" or die "Failed to open tests.log\n";
66

7-
my $ignore = 1;
7+
my $printed_this_test = 1;
88
my $current_test = "";
99

1010
while (<LOG>) {
1111
chomp;
1212
if (/^Test '(.+)'/) {
1313
$current_test = $1;
14-
$ignore = 0;
15-
} elsif (1 == $ignore) {
16-
next;
14+
$printed_this_test = 0;
1715
} elsif (/\[FAILED\]\s*$/) {
18-
$ignore = 1;
19-
print "Failed test: $current_test\n";
20-
my $outf = `sed -n '2p' $current_test/test.desc`;
21-
$outf =~ s/\..*$/.out/;
22-
system("cat $current_test/$outf");
23-
print "\n\n";
16+
if(0 == $printed_this_test) {
17+
$printed_this_test = 1;
18+
print "\n\n";
19+
print "Failed test: $current_test\n";
20+
my $outf = `sed -n '2p' $current_test/test.desc`;
21+
$outf =~ s/\..*$/.out/;
22+
system("cat $current_test/$outf");
23+
print "\n\nFailed test.desc lines:\n";
24+
}
25+
print "$_\n";
2426
}
2527
}
2628

src/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
DIRS = ansi-c big-int cbmc cpp goto-cc goto-instrument goto-programs \
22
goto-symex langapi pointer-analysis solvers util linking xmllang \
3-
assembler analyses java_bytecode aa-path-symex path-symex musketeer \
4-
json cegis goto-analyzer jsil symex goto-diff aa-symex clobber \
3+
assembler analyses java_bytecode path-symex musketeer \
4+
json cegis goto-analyzer jsil symex goto-diff clobber \
55
memory-models
66

77
all: cbmc.dir goto-cc.dir goto-instrument.dir symex.dir goto-analyzer.dir goto-diff.dir

src/cbmc/cbmc_parse_options.h

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class optionst;
5656
"(graphml-witness):" \
5757
"(java-max-vla-length):(java-unwind-enum-static)" \
5858
"(localize-faults)(localize-faults-method):" \
59+
"(lazy-methods)" \
5960
"(fixedbv)(floatbv)(all-claims)(all-properties)" // legacy, and will eventually disappear // NOLINT(whitespace/line_length)
6061

6162
class cbmc_parse_optionst:

src/goto-cc/compile.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,8 @@ bool compilet::parse(const std::string &file_name)
544544

545545
language_filet language_file;
546546

547-
std::pair<language_filest::filemapt::iterator, bool>
548-
res=language_files.filemap.insert(
547+
std::pair<language_filest::file_mapt::iterator, bool>
548+
res=language_files.file_map.insert(
549549
std::pair<std::string, language_filet>(file_name, language_file));
550550

551551
language_filet &lf=res.first->second;
@@ -736,7 +736,7 @@ bool compilet::parse_source(const std::string &file_name)
736736
return true;
737737

738738
// so we remove it from the list afterwards
739-
language_files.filemap.erase(file_name);
739+
language_files.file_map.erase(file_name);
740740
return false;
741741
}
742742

src/goto-programs/get_goto_model.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ bool get_goto_modelt::operator()(const std::vector<std::string> &files)
7575
return true;
7676
}
7777

78-
std::pair<language_filest::filemapt::iterator, bool>
79-
result=language_files.filemap.insert(
78+
std::pair<language_filest::file_mapt::iterator, bool>
79+
result=language_files.file_map.insert(
8080
std::pair<std::string, language_filet>(filename, language_filet()));
8181

8282
language_filet &lf=result.first->second;

src/goto-programs/remove_virtual_functions.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ void remove_virtual_functionst::get_functions(
339339
component_name,
340340
functions);
341341

342-
functions.push_back(root_function);
342+
if(root_function.symbol_expr!=symbol_exprt())
343+
functions.push_back(root_function);
343344
}
344345

345346
/*******************************************************************\

0 commit comments

Comments
 (0)