Skip to content

Fix stub string lengths #2603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions jbmc/regression/jbmc-strings/stub-string-length/Opaque.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

public class Opaque {

public static String getstr() { return null; }

}
Binary file not shown.
12 changes: 12 additions & 0 deletions jbmc/regression/jbmc-strings/stub-string-length/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

public class Test {

public static void main() {

String s = Opaque.getstr();
if(s != null)
assert s.length() <= 10;

}

}
6 changes: 6 additions & 0 deletions jbmc/regression/jbmc-strings/stub-string-length/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CORE
Test.class
--function Test.main --max-nondet-string-length 10
VERIFICATION SUCCESSFUL
EXIT=0
SIGNAL=0
8 changes: 5 additions & 3 deletions jbmc/src/jbmc/jbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,11 @@ int jbmc_parse_optionst::doit()
? std::stoul(cmdline.get_value("java-max-input-array-length"))
: MAX_NONDET_ARRAY_LENGTH_DEFAULT;
object_factory_params.max_nondet_string_length =
cmdline.isset("string-max-input-length")
? std::stoul(cmdline.get_value("string-max-input-length"))
: MAX_NONDET_STRING_LENGTH;
cmdline.isset("max-nondet-string-length")
? std::stoul(cmdline.get_value("max-nondet-string-length"))
: cmdline.isset("string-max-input-length") // obsolete; will go away
? std::stoul(cmdline.get_value("string-max-input-length"))
: MAX_NONDET_STRING_LENGTH;
object_factory_params.max_nondet_tree_depth =
cmdline.isset("java-max-input-tree-depth")
? std::stoul(cmdline.get_value("java-max-input-tree-depth"))
Expand Down