10
10
11
11
#include < ansi-c/ansi_c_language.h>
12
12
#include < cpp/cpp_language.h>
13
- #include < java_bytecode/java_bytecode_language.h>
14
- #include < jsil/jsil_language.h>
15
-
16
- #include < json/json_parser.h>
17
-
18
13
#include < goto-programs/adjust_float_expressions.h>
19
- #include < goto-programs/set_properties.h>
20
14
#include < goto-programs/dead_code_elimination.h>
21
- #include < goto-programs/remove_virtual_functions.h>
15
+ #include < goto-programs/goto_inline.h>
16
+ #include < goto-programs/read_goto_binary.h>
22
17
#include < goto-programs/remove_returns.h>
23
18
#include < goto-programs/remove_skip.h>
19
+ #include < goto-programs/remove_virtual_functions.h>
20
+ #include < goto-programs/set_properties.h>
24
21
#include < goto-programs/show_properties.h>
25
22
#include < goto-programs/show_symbol_table.h>
26
- #include < goto-programs/read_goto_binary.h>
27
- #include < goto-programs/goto_inline.h>
23
+ #include < java_bytecode/java_bytecode_language.h>
24
+ #include < jsil/jsil_language.h>
25
+ #include < linking/static_lifetime_init.h>
28
26
29
27
#include < analyses/call_graph.h>
30
28
#include < analyses/call_graph_helpers.h>
31
29
#include < analyses/goto_check.h>
32
30
#include < analyses/local_may_alias.h>
33
31
34
32
#include < java_bytecode/convert_java_nondet.h>
35
- #include < java_bytecode/java_utils.h>
36
33
#include < java_bytecode/remove_exceptions.h>
37
34
#include < java_bytecode/remove_instanceof.h>
38
35
#include < java_bytecode/remove_java_new.h>
39
36
#include < java_bytecode/replace_java_nondet.h>
40
37
41
- #include < langapi/language.h>
42
38
#include < langapi/mode.h>
43
39
44
40
#include < util/options.h>
45
41
#include < util/config.h>
46
42
#include < util/string2int.h>
47
- #include < util/msgstream.h>
48
- #include < util/prefix.h>
49
43
#include < util/json_map_serializer.h>
50
44
#include < util/exit_codes.h>
51
45
52
- #include < cbmc/version.h>
53
-
54
- #include < summaries/summary.h>
55
46
#include < taint-analysis/taint_statistics.h>
56
- #include < taint-analysis/taint_statistics_dump.h>
57
- #include < taint-analysis/taint_summary.h>
58
47
#include < taint-analysis/taint_summary_dump.h>
59
48
60
49
#include < taint-analysis/taint_security_scanner.h>
61
50
51
+ #include < java_bytecode/simple_method_stubbing.h>
62
52
#include < pointer-analysis/add_failed_symbols.h>
63
53
#include < pointer-analysis/evs_pretty_printer.h>
64
- #include < pointer-analysis/local_value_set.h>
65
54
66
55
#include " csvsa_specializer.h"
67
56
#include " sec_driver_parse_options.h"
68
57
69
- #include < fstream>
70
-
71
58
sec_driver_parse_optionst::sec_driver_parse_optionst (int argc, const char **argv):
72
59
parse_options_baset(SEC_DRIVER_OPTIONS, argc, argv),
73
60
language_uit(cmdline, ui_message_handler),
@@ -104,6 +91,20 @@ void sec_driver_parse_optionst::get_command_line_options(optionst &options)
104
91
usage_error ();
105
92
exit (1 );
106
93
}
94
+
95
+ if (cmdline.isset (" java-max-input-array-length" ))
96
+ object_factory_params.max_nondet_array_length =
97
+ std::stoul (cmdline.get_value (" java-max-input-array-length" ));
98
+
99
+ if (cmdline.isset (" string-max-input-length" ))
100
+ object_factory_params.max_nondet_string_length =
101
+ std::stoul (cmdline.get_value (" string-max-input-length" ));
102
+
103
+ if (cmdline.isset (" java-max-input-tree-depth" ))
104
+ object_factory_params.max_nondet_tree_depth =
105
+ std::stoul (cmdline.get_value (" java-max-input-tree-depth" ));
106
+
107
+ stub_objects_are_not_null = cmdline.isset (" java-assume-inputs-non-null" );
107
108
}
108
109
109
110
static irep_idt get_cprover_start_main_callee (const goto_modelt &goto_model)
@@ -542,7 +543,8 @@ bool sec_driver_parse_optionst::process_goto_functions(
542
543
543
544
bool sec_driver_parse_optionst::can_generate_function_body (const irep_idt &name)
544
545
{
545
- return false ;
546
+ static const irep_idt initialize_id = INITIALIZE_FUNCTION;
547
+ return name != goto_functionst::entry_point () && name != initialize_id;
546
548
}
547
549
548
550
bool sec_driver_parse_optionst::generate_function_body (
@@ -551,7 +553,33 @@ bool sec_driver_parse_optionst::generate_function_body(
551
553
goto_functiont &function,
552
554
bool body_available)
553
555
{
554
- return false ;
556
+ // Provide a simple stub implementation for any function we don't have a
557
+ // bytecode implementation for:
558
+
559
+ if (body_available)
560
+ return false ;
561
+
562
+ if (!can_generate_function_body (function_name))
563
+ return false ;
564
+
565
+ if (symbol_table.lookup_ref (function_name).mode == ID_java)
566
+ {
567
+ java_generate_simple_method_stub (
568
+ function_name,
569
+ symbol_table,
570
+ stub_objects_are_not_null,
571
+ object_factory_params,
572
+ get_message_handler ());
573
+
574
+ goto_convert_functionst converter (symbol_table, get_message_handler ());
575
+ converter.convert_function (function_name, function);
576
+
577
+ return true ;
578
+ }
579
+ else
580
+ {
581
+ return false ;
582
+ }
555
583
}
556
584
557
585
// / display command line help
0 commit comments