Skip to content

Unsoundness with Arrays in JBMC #8428

Closed
@lks9

Description

@lks9

Environment

CBMC version: 6.1.1 (cbmc-6.1.1-34-gc193c276ab)
Operating system: Linux 5.15.0-119-generic #129~20.04.1-Ubuntu SMP x86_64

Explanation

In ExampleTraceAssertion.zip, I have two files Example.java and example.c. I am checking example() in both versions.

Both versions should lead to VERIFICATION FAILED because the assertion in line 14 (reached from example()) is counter satisfiable. However the jbmc version reports SUCCESS.

Exact command line resulting in the issue:

jbmc   "Example.example:([III)V" --throw-runtime-exceptions --disable-uncaught-exception-check  --unwind 9 --unwinding-assertions

Expected (JBMC version)

The assertion verification should fail:

** Results:
Example.java function java::Example.example:([III)V
[java::Example.example:([III)V.unwind.1] line 35 unwinding assertion loop 1: SUCCESS
[java::Example.example:([III)V.unwind.0] line 45 unwinding assertion loop 0: SUCCESS
[java::Example.example:([III)V.assertion.1] line 54 assertion at file Example.java line 54 function java::Example.example:([III)V bytecode-index 247: SUCCESS

Example.java function java::Example.next_elem:(I)V
[java::Example.next_elem:(I)V.assertion.1] line 14 assertion at file Example.java line 14 function java::Example.next_elem:(I)V bytecode-index 29: FAILURE

** 1 of 4 failed (2 iterations)
VERIFICATION FAILED

What happened instead (JBMC version)

But instead jbmc reports false success:

** Results:
Example.java function java::Example.example:([III)V
[java::Example.example:([III)V.unwind.1] line 35 unwinding assertion loop 1: SUCCESS
[java::Example.example:([III)V.unwind.0] line 45 unwinding assertion loop 0: SUCCESS
[java::Example.example:([III)V.assertion.1] line 54 assertion at file Example.java line 54 function java::Example.example:([III)V bytecode-index 210: SUCCESS

Example.java function java::Example.next_elem:(I)V
[java::Example.next_elem:(I)V.assertion.1] line 14 assertion at file Example.java line 14 function java::Example.next_elem:(I)V bytecode-index 29: SUCCESS

** 0 of 4 failed (1 iterations)
VERIFICATION SUCCESSFUL

Variation I as expected

cbmc with example.c gives the expected result:

cbmc example.c --function example --no-standard-checks --unwind 9 --unwinding-assertions

Variation II as expected

jbmc with a concrete array int[] a = { 413, 134, 1, 41, -32, 0, -500, 413, 1 }; gives the expected result. Just comment out that line and comment in int[] a = a2;.

Variation III as expected

Change assert(index != 18) to assert(index != 17) in line 14 of Example.java.

Further remarks

This is a simplified excerpt of one of my retracing examples, DualPivotQuicksort from https://github.com/ProRunVis/ProRunVis-examples. I can show you the full example if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions