Skip to content

cbmc --verbosity 10 --xml-ui invariant failure #7038

@markrtuttle

Description

@markrtuttle

CBMC version: 5.61.0
Operating system: MacOS 11.6.7

Create the file main.c

#include<assert.h>

int main() {
  int x;
  assert(x);
}

and run the command

cbmc --verbosity 10 --xml-ui main.c

and cbmc fails with

--- begin invariant violation report ---
Invariant check failed
File: /tmp/cbmc-20220707-65576-1rz4dy2/src/util/xml.cpp:113 function: escape
Condition: ch >= ' '
Reason: XML does not support escaping non-printable character 226
Backtrace:
...
--- end invariant violation report ---
Abort trap: 6

I think the problem is that --verbosity 10 generates lines like

ASSERT ¬(main::1::x!0@1#1 = 0)

and the character ¬ is extended ASCII character 170 (I can't explain the 226 in the error message). In xml.cpp, line 113 asserts the data invariant ch > ' ' but since ch=170 interpreted as a signed character is negative, the assertion fails and the invariant failure is thrown. I think the check ch > ' ' is intended to skip the unprintable characters below the space character in ASCII, but I think the extended ASCII characters above 128 are mostly printable characters and should be okay.

Metadata

Metadata

Assignees

Labels

awsBugs or features of importance to AWS CBMC usersaws-medium

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions