Skip to content

Crash with json ui #6691

@zhassan-aws

Description

@zhassan-aws

CBMC version: cbmc-5.50.0
Operating system: Ubuntu 20.04

Running the attached example with:

cbmc --unwind 2 --object-bits 10 a.out --pointer-check --json-ui

causes CBMC to crash:

[
  {
    "program": "CBMC 5.50.0 (cbmc-5.50.0)"
  },
  {
    "messageText": "CBMC version 5.50.0 (cbmc-5.50.0) 64-bit x86_64 linux",
    "messageType": "STATUS-MESSAGE"
  },
  {
    "messageText": "Reading GOTO program from file a.out",
    "messageType": "STATUS-MESSAGE"
  },

<snip>

            "assignmentType": "variable",
            "hidden": true,
            "internal": false,
            "lhs": "var_3.cases",
            "mode": "C",
            "sourceLocation": {
              "column": "27",
              "file": "/rustc/0c292c9667f1b202a9150d58bdd2e89e3e803996/library/core/src/result.rs",
              "function": "<std::result::Result<T, F> as std::ops::FromResidual<std::result::Result<std::convert::Infallible, E>>>::from_residual",
              "line": "2052"
            },
            "stepType": "assignment",
            "thread": 0,
            "value": {
              "member": {
                "name": "UnexpectedEof",
                "value": {
                  "members": [
                    {
                      "name": "0",
                      "value": {
                        "binary": "0000000000000000000000000000000000000000000000000000000000001000",
                        "data": "8ul",
                        "name": "integer",
                        "type": "__CPROVER_size_t",
                        "width": 64
                      }
                    }
                  ],
                  "name": "struct"
                }
              },
              "name": "union"
            }
          }--- begin invariant violation report ---
Invariant check failed
File: ../src/util/expr_cast.h:256 function: validate_operands
Condition: allow_more ? value.operands().size()>=number : value.operands().size()==number
Reason: Unary expressions must have one operand
Backtrace:
cbmc(print_backtrace(std::ostream&)+0x50) [0x55ec297ff270]
cbmc(get_backtrace[abi:cxx11]()+0x169) [0x55ec297ff819]
cbmc(std::enable_if<std::is_base_of<invariant_failedt, invariant_failedt>::value, void>::type invariant_violated_structured<invariant_failedt, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x48) [0x55ec29098368]
cbmc(validate_operands(exprt const&, unsigned long, char const*, bool)+0xd8) [0x55ec2918a828]
cbmc(json(exprt const&, namespacet const&, dstringt const&)+0x4373) [0x55ec2942dbe3]
cbmc(json(exprt const&, namespacet const&, dstringt const&)+0x2bbf) [0x55ec2942c42f]
cbmc(json(exprt const&, namespacet const&, dstringt const&)+0x2bbf) [0x55ec2942c42f]
cbmc(json(exprt const&, namespacet const&, dstringt const&)+0x8dc) [0x55ec2942a14c]
cbmc(json(exprt const&, namespacet const&, dstringt const&)+0x2bbf) [0x55ec2942c42f]
cbmc(convert_decl(json_objectt&, conversion_dependenciest const&, trace_optionst const&)+0xf2c) [0x55ec29436a5c]
cbmc(void convert<json_stream_arrayt>(namespacet const&, goto_tracet const&, json_stream_arrayt&, trace_optionst)+0x5c2) [0x55ec290bb2d2]
cbmc(output_properties_with_traces(std::map<dstringt, property_infot, std::less<dstringt>, std::allocator<std::pair<dstringt const, property_infot> > > const&, goto_trace_storaget const&, trace_optionst const&, unsigned long, ui_message_handlert&)+0xbec) [0x55ec290d2b5c]
cbmc(all_properties_verifier_with_trace_storaget<multi_path_symex_checkert>::report()+0x94) [0x55ec290a03e4]
cbmc(cbmc_parse_optionst::doit()+0xf9a) [0x55ec2909f81a]
cbmc(parse_options_baset::main()+0x8f) [0x55ec2909647f]
cbmc(main+0x39) [0x55ec29084d39]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f3c3c4180b3]
cbmc(_start+0x2e) [0x55ec29097d7e]


--- end invariant violation report ---

If I take out the --json-ui option, it doesn't crash:

CBMC version 5.50.0 (cbmc-5.50.0) 64-bit x86_64 linux
Reading GOTO program from file a.out
Generating GOTO Program
Adding CPROVER library (x86_64)
Removal of function pointers and virtual functions
Generic Property Instrumentation
Running with 10 object bits, 54 offset bits (user-specified)
Starting Bounded Model Checking

<snip>


** 10 of 1128 failed (4 iterations)
VERIFICATION FAILED

json-ui-crash.tar.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    awsBugs or features of importance to AWS CBMC usersaws-highpending merge

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions